1

I'm using one from the built-in list item layout in my app.

I want to change the style of this list like text color or size of text .

I'm using simple_list_item_1 from these items .

Can you help me how I can do that.

HaveNoDisplayName
  • 7,711
  • 106
  • 32
  • 44
Samah Ahmed
  • 389
  • 6
  • 23

3 Answers3

0
You should make a custom Layout and inflate it in getView() method of Adapter.


 public View getView(int position, View convertView, ViewGroup parent) {

        LayoutInflater inflater = getLayoutInflater();
        View row;
        row = inflater.inflate(R.layout.custom, parent, false);
        TextView title, detail;
        ImageView i1;
        title = (TextView) row.findViewById(R.id.title);
        detail = (TextView) row.findViewById(R.id.detail);
        i1=(ImageView)row.findViewById(R.id.img);
        title.setText(Title[position]);
        detail.setText(Detail[position]);
        i1.setImageResource(imge[position]);

        return (row);
    }

you can look into this thing more on Custom Listview

and from my personal opinion you can use RecyclerView for better Customisation.

Community
  • 1
  • 1
androgo
  • 524
  • 2
  • 8
0

Do you mean in the Android Studio preview?

If so, tools:listitem="@layout/list-item-layout" is your friend.

AlikElzin-kilaka
  • 30,165
  • 25
  • 168
  • 248
-1

Create your own layout and place it in your app layout directory and refer that in your code instead of simple_list_item_1

Example here

R.layout.<yourLayoutName>

instead of

android.R.layout.simple_list_item_1

And customize the layout as you like it!!

johnrao07
  • 5,813
  • 3
  • 26
  • 45