Skip to content Skip to sidebar Skip to footer

I Am Trying To Implement A Custom Listview Using Arrayadapter But All The Items Are Not Showing In The Screen

MainActivity.java public class MainActivity extends Activity { ListView list; String[] titles; String[] description; int imgs[]={R.drawable.facebook,R.drawable.instagram,R.drawabl

Solution 1:

I think that your issue might be in getView method or your adapter. You should use 'row' view to find child controls.

Viewrow= layoutInflater.inflate(R.layout.row, parent, false);
ImageViewimages= (ImageView) row.findViewById(R.id.logo);
TextViewmyTitle= (TextView) row.findViewById(R.id.text1);
TextViewmyDescription= (TextView) row.findViewById(R.id.text2);

Solution 2:

You need add LayoutManager to you listView/RecyclerView. Before set adapter.

how do:

rvCategories.setHasFixedSize(true);
rvCategories.setLayoutManager(newLinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));

Remember, we have more layouts managers..

And you need initialization of your components. Detail: row.findViewById.

Viewrow= layoutInflater.inflate(R.layout.row, parent, false);
ImageViewimages= (ImageView) row.findViewById(R.id.logo);
TextViewmyTitle= (TextView) row.findViewById(R.id.text1);
TextViewmyDescription= (TextView) row.findViewById(R.id.text2);

Solution 3:

I think problem is in your getView() method. You forgot to put object of your view for find IDs.

Viewrow= layoutInflater.inflate(R.layout.row, parent, false);
ImageViewimages= (ImageView) row.findViewById(R.id.logo);
TextViewmyTitle= (TextView) row.findViewById(R.id.text1);
TextViewmyDescription= (TextView) row.findViewById(R.id.text2);

Post a Comment for "I Am Trying To Implement A Custom Listview Using Arrayadapter But All The Items Are Not Showing In The Screen"