Reputation: 21
Below is code of my girdview. i need to change font size of the data. i aslo need to change default selection colour which is orange. please help i am new to android development.
String[] tes={"AAA","BBB","CCC"};
ArrayAdapter<String> aa = new ArrayAdapter<String>(
this,
android.R.layout.simple_list_item_1,
tes );
gv.setAdapter(aa);
gv.setOnItemClickListener(this);
Upvotes: 1
Views: 8676
Reputation: 63
a little bit too late but for others who are looking for it will work :
first you create this a simple_textview.xml(put it a name)
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:shadowColor="@color/grisActionBar"
/>
then in yout activity or fragment you set the adapter with the created textview.xml
gvMain = (GridView)v.findViewById(R.id.gridView);
gvMain.setAdapter(new ArrayAdapter<String
(getActivity(),R.layout.simple_textview,data));
Upvotes: 0
Reputation: 733
You have to change the font size in the baseadapter class for the gridview.
Like this:
public View getView(int position, View convertView, ViewGroup parent) {
TextView tv;
if (convertView == null) {
tv = new TextView(context);
tv.setLayoutParams(new GridView.LayoutParams(100, 80));
tv.setTextSize(20); //text size in gridview
}
The gridview just show whatever the
gridview.setAdapter(new MyAdapter (thi));" //MyAdapter class is where the getView method run
sets the setAdapter to contain.
Upvotes: 3
Reputation: 1615
You can change it in the XML file, if you write android:textColor="#000000" where 000000 is the code of your color hexcode what you want.
Upvotes: 0