我希望在我的安卓应用程序中更改GridView的字体大小。
以下是我创建GridView的代码:
GridView gridview = (GridView)findViewById(R.id.gridView);
ArrayAdapter<String> arrayadapter = new ArrayAdapter<String>(
this,
R.layout.customstyle,
Rows );
gridview.setNumColumns(14);
gridview.setAdapter(arrayadapter);
以下是我自定义样式 .xml 文档中的代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/grid_item_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="8dip" >
</TextView>
</LinearLayout>
当前程序在我试图应用自定义样式时崩溃,但当它使用标准样式时,它可以正常工作。 因此,有人能帮助我修复这个样式,以便我可以设置字体大小。 谢谢。
TextView
时,应该使用sp
而不是dp
。 - Pragnani