Universal Image Loader image scaling distortion - java

I have a ListView that presents a picture and some text on each row. The picture is loaded dynamically at run time using Universal Image Loader. It works, but the problem is that the pictures are not scaled correctly. I want them to be scaled to retain their original aspect ratio, but instead they are stretched to fill the square dimension of their container thereby distorting many of the images.
The listview adapter is this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/transparent">
<ImageView
android:id="#+id/image"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_margin="6dp"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:src="#drawable/my_img"/>
<TextView
android:layout_toRightOf="#+id/image"
android:textSize="16sp"
android:id="#+id/coach_name"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
The image gets loaded from a server at run time. This is the adapter class:
public class CoachAdapter extends ArrayAdapter<String> {
private static Context context;
private ArrayList<String> coach_list;
private DisplayImageOptions doption=null;
private ImageLoadingListener animateFirstListener =null;
public CoachAdapter(Context context, int textViewResourceId, ArrayList<String> coach_list) {
super(context, textViewResourceId, coach_list);
this.context = context;
this.coach_list = coach_list;
doption=new DisplayImageOptions.Builder()
.showImageForEmptyUri(R.drawable.my_img)
.showImageOnFail(R.drawable.my_img)
.showImageOnLoading(R.drawable.my_img)
.cacheInMemory(true)
.cacheOnDisk(true)
.displayer(new RoundedBitmapDisplayer(8))
.imageScaleType(ImageScaleType.EXACTLY)
.postProcessor(new BitmapProcessor() {
#Override
public Bitmap process(Bitmap bmp) {
return Bitmap.createScaledBitmap(bmp, 32, 32, false);
}
})
.build();
animateFirstListener = new AnimateFirstDisplayListener();
}
#Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
public View getCustomView(int position, View convertView, ViewGroup parent) {
View row = convertView;
final ViewHolder holder;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.row_coach, parent, false);
holder = new ViewHolder();
holder.text = (TextView) row.findViewById(R.id.coach_name);
holder.image = (ImageView) row.findViewById(R.id.image);
row.setTag(holder);
} else {
holder = (ViewHolder) row.getTag();
}
String coach_name = coach_list.get(position);
// get the url string from the database
Coach this_coach = myDB.getCoachFromName(coach_name);
String coach_picture_url = this_coach.getCoachPictureURL();
holder.text.setText(coach_name);
holder.image.setScaleType(ImageView.ScaleType.FIT_CENTER);
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.init(ImageLoaderConfiguration.createDefault(context));
imageLoader.displayImage(url, holder.image, doption, animateFirstListener);
return row;
}
private static class AnimateFirstDisplayListener extends SimpleImageLoadingListener {
static final List<String> displayedImages = Collections.synchronizedList(new LinkedList<String>());
#Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (loadedImage != null) {
ImageView imageView = (ImageView) view;
boolean firstDisplay = !displayedImages.contains(imageUri);
if (firstDisplay) {
FadeInBitmapDisplayer.animate(imageView, 500);
displayedImages.add(imageUri);
}
}
}
}
private class ViewHolder {
public TextView text;
public ImageView image;
}
}
As I read the UniversalImageLoader docs, this is supposed scale the images based on what is specified in the XML file. I've tried fitCenter and fitXY. No matter what I specify, the image is always square. I've also verified that the dimensions of many of the original images are NOT square, so I know that the scaling distortion is happening here.
Any one see what I am doing wrong? Thank you!

Related

How can i create a custom ListView with my xml layout file?

Java code
list view layout #1
How can i insert change the graphics of my ListView adding this layout file to my list view? What should i write in my java code for making each row of my ListView just like my layout file. Thank you all guys !!
First of all you need to create the xml for the custom row you want(custom_row.xml):
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="8dp"
android:id="#+id/text" /> </LinearLayout>
Then you need to create your custom adapter:
public class CustomAdapter extends BaseAdapter {
Context context;
List<String> textArray;
LayoutInflater inflater;
public RutinaAdapter(Context context, List<String> textarray) {
this.context = context;
inflater = LayoutInflater.from(context);
this.textArray = textarray;
}
#Override
public int getCount() {
return textArray.size();
}
#Override
public Object getItem(int position) {
return textArray.get(position);
}
#Override
public long getItemId(int position) {
return position;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewGroup vg;
if (convertView != null) {
vg = (ViewGroup) convertView;
} else {
vg = (ViewGroup) inflater.inflate(R.layout.custom_row, null);
}
String text = textArray.get(position);
final TextView text = ((TextView) vg.findViewById(R.id.text));
return vg;
} }
Then you need to add the adapter to the ListView:
list = (ListView) view.findViewById(R.id.list);
CustomAdapter adapter = new CustomAdapter(getContext(),textArray);
list.setAdapter(adapter1);
Add info to you textArray, and notify the adapter data changed, and thats it.

ListView inside a ListItem displays only one entry

Inside my original Activity, I initialize an Adapter to populate a ListView and that goes smoothly. ArrayList populated with all the data gets passed as an argument to the Adapter and everything goes well.
Now inside that Adapter, or that ListView that gets populated, there's another ListView and another Adapter for it.
Again, I follow the same procedure and populate the Adapter with an ArrayList, but it seems as though only the first entry gets displayed in the nested ListView. I assume this is is because the parent ListView gets populated and the data for the child ListView only populates for one parents entry.
Anyway, here's the adapter initialization and the Adapter class:
PlayerSeasonsStatsAdapter pssAdapter = new PlayerSeasonsStatsAdapter(getContext(), alPlayerSeasonsStats);
vh.lvPlayerSeasonsStats.setAdapter(pssAdapter);
alPlayerSeasonsStats is an ArrayList containing data to populate the child ListView.
Here's the child Adapter:
public class PlayerSeasonsStatsAdapter extends ArrayAdapter{
private ArrayList<PlayerStatsTeamModelSeasons> playerSeasons = new ArrayList<PlayerStatsTeamModelSeasons>();
private LayoutInflater mInflater;
public PlayerSeasonsStatsAdapter(Context context, ArrayList<PlayerStatsTeamModelSeasons> playerSeasons) {
super(context, 0, playerSeasons);
this.playerSeasons = playerSeasons;
mInflater = LayoutInflater.from(context);
}
#Override
public PlayerStatsTeamModelSeasons getItem(int position) {
return playerSeasons.get(position);
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder vh;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.player_seasons_stats_row, parent, false);
vh = new ViewHolder();
vh.tvPSSRCompetition = (TextView) convertView.findViewById(R.id.tvPSSRCompetition);
vh.tvPSSRMatchesPlayed = (TextView) convertView.findViewById(R.id.tvPSSRMatchesPlayed);
vh.tvPSSRGoalsScored = (TextView) convertView.findViewById(R.id.tvPSSRGoalsScored);
vh.tvPSSRAssists = (TextView) convertView.findViewById(R.id.tvPSSRAssists);
vh.tvPSSRYellowCards = (TextView) convertView.findViewById(R.id.tvPSSRYellowCards);
vh.tvPSSRRedCards = (TextView) convertView.findViewById(R.id.tvPSSRRedCards);
vh.ivPSSRCompetitionLogo = (ImageView) convertView.findViewById(R.id.ivPSSRCompetitionLogo);
convertView.setTag(vh);
} else {
vh = (ViewHolder) convertView.getTag();
}
PlayerStatsTeamModelSeasons pstmsModel = getItem(position);
vh.tvPSSRCompetition.setText(pstmsModel.pstmSeasonModel.name);
vh.tvPSSRMatchesPlayed.setText(pstmsModel.pstmsModel.matchesPlayed);
vh.tvPSSRGoalsScored.setText(pstmsModel.pstmsModel.goalsScored);
vh.tvPSSRAssists.setText(pstmsModel.pstmsModel.assists);
vh.tvPSSRYellowCards.setText(pstmsModel.pstmsModel.yellowCards);
int totalRedCards = Integer.parseInt(pstmsModel.pstmsModel.yellowRedCards) + Integer.parseInt(pstmsModel.pstmsModel.redCards);
vh.tvPSSRRedCards.setText(totalRedCards + "");
//loadLogoToView(vh.ivPSSRCompetitionLogo, pstmsModel.pstmSeasonModel.id, true);
return convertView;
}
public static void loadLogoToView(ImageView iv, String teamId, boolean transform) {
String image = Constant.IMAGES_ROOT +
Constant.LOGO_PATH +
teamId +
Constant.LOGO_EXTENSION;
RequestCreator img = Picasso.with(iv.getContext())
.load(image);
if (transform) img.transform(new RoundedCornersTransform(2));
img.into(iv);
}
static class ViewHolder {
ImageView ivPSSRCompetitionLogo;
TextView tvPSSRCompetition;
TextView tvPSSRMatchesPlayed;
TextView tvPSSRGoalsScored;
TextView tvPSSRAssists;
TextView tvPSSRYellowCards;
TextView tvPSSRRedCards;
}
What are my options here?
Your Adapter should be look like
public class PlayerSeasonsStatsAdapter extends ArrayAdapter<PlayerStatsTeamModelSeasons> {
private class ViewHolder {
TextView tvPSSRCompetition;
}
public PlayerSeasonsStatsAdapter(Context context, List<PlayerStatsTeamModelSeasons> balanceModels) {
super(context, R.layout.row_account_balance, balanceModels);
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
PlayerStatsTeamModelSeasons model = getItem(position);
PlayerSeasonsStatsAdapter.ViewHolder viewHolder;
if (convertView == null) {
viewHolder = new PlayerSeasonsStatsAdapter.ViewHolder();
LayoutInflater inflater = LayoutInflater.from(getContext());
convertView = inflater.inflate(R.layout.row_account_balance, parent, false);
viewHolder.tvPSSRCompetition = (TextView) convertView.findViewById(R.id.tvPSSRCompetition);
convertView.setTag(viewHolder);
} else {
viewHolder = (PlayerSeasonsStatsAdapter.ViewHolder) convertView.getTag();
}
viewHolder.tvPSSRCompetition.setText(model.getPSSRCompetition());
if (position%2== 0) {
convertView.setBackgroundColor(Color.parseColor("#F5EEE5"));
}else{
convertView.setBackgroundColor(Color.parseColor("#FFFFFF"));
}
return convertView;
}
}
Just Call below like
PlayerSeasonsStatsAdapter adapter = new PlayerSeasonsStatsAdapter(MainActivity.this, balanceList);
listView.setAdapter(adapter);
Listview Look like bellow
<ListView
android:id="#+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
here is row_account_balance layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/tvPSSRCompetition"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|center_vertical|center_horizontal"
android:text="#string/agent_statement_sl"
android:textStyle="bold"
android:paddingLeft="2dp"
android:textSize="16sp"
android:paddingBottom="5dp"
android:paddingTop="5dp"/>
</LinearLayout>

How to extends ArrayAdapter to print Parsed JSON?

I have tried and read so many answers but can't able to figure out how to properly code...
NewsAdapter.java
public class NewsAdapter extends ArrayAdapter{
private static final String DEBUG_TAG = "NEWSADAPTER";
private LayoutInflater inflater;
public NewsAdapter(Activity activity, ArrayList<String> items){
super(activity, R.layout.news_feed, items);
Log.d(DEBUG_TAG, "This is came from the world i know of" + items);
inflater = activity.getWindow().getLayoutInflater();
}
#Override
public View getView(int position, View convertView, ViewGroup parent){
return inflater.inflate(R.layout.news_feed, parent, false);
}
}
news_feed.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">
<TextView android:id="#+id/title"
android:text="#string/news_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="19sp" />
</LinearLayout>
And the output of above code is ...
How to get items value and how to setText ?
Do like this:
public class NewsAdapter extends ArrayAdapter{
private static final String DEBUG_TAG = "NEWSADAPTER";
private LayoutInflater inflater;
ArrayList<String> items;
public NewsAdapter(Activity activity, ArrayList<String> items){
inflater = activity.getWindow().getLayoutInflater();
this.items = items;
}
#Override
public View getView(int position, View convertView, ViewGroup parent){
View v = convertView
if(v == null)
v = inflater.inflate(R.layout.news_feed, parent, false);
TextView txtTitle = (TextView) v.findViewById(R.id.title);
txtTitle.setText(items.get(position));
return v;
}
}

Android Code using Fragments with listView

So my coding got a few problems in its fragment the line "super(FragmentDishcover.this, R.layout.listviewdishcover, LV_Dishcover);" goes red line. i copied most of its files on the net and got no idea whats "getLayoutInflater()" is for. i thought it a new class or something but well tell me if it its please.
my FragmentD.class
public class FragmentD extends Fragment {
public FragmentD(){}
private List<NavItemViewlistD> LV_D = new ArrayList<NavItemViewlistD>();
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_d, container, false);
populateListViewD();
populateListView();
return rootView;
}
private void populateListViewD(){
LV_D.add(new NavItemViewlistD("Trololololol", R.drawable.kittylogotemp, R.drawable.ic_paw_white, 10));
LV_D.add(new NavItemViewlistD("booom", R.drawable.kittylogotemp, R.drawable.ic_paw_white, 20));
LV_D.add(new NavItemViewlistD("ahahahaha", R.drawable.kittylogotemp, R.drawable.ic_paw_white, 30));
}
private void populateListView(){
ArrayAdapter<NavItemViewlistD> adapter = new dListAdapter();
ListView list = (ListView) getActivity().findViewById(R.id.listViewD);
list.setAdapter(adapter);
}
private class dListAdapter extends ArrayAdapter<NavItemViewlistD>{
private dListAdapter(){
super(FragmentD.this, R.layout.listviewd, LV_D);
}
#Override
public View getView(int position, View convertView, ViewGroup parent){
View itemView = convertView;
if(itemView == null){
itemView = getLayoutInflater().inflate(R.layout.listviewd, parent, false);
}
return itemView;
}
}
}
this is my NavItemViewList.java
public class NavItemViewlist {
private String title;
private int image;
private int icon;
private int points;
public NavItemViewlist(String title, int image, int icon, int points){
super();
this.title = title;
this.image = image;
this.icon = icon;
this.points = points;
}
public String getTitle(){
return title;
}
public int getImage(){
return image;
}
public int getIcon(){
return icon;
}
public int getPoints(){
return points;
}
}
YOUR DOING IN WRONG WAY.i suggested you to not include adapter in fragment.use as separate class like this
public class SampAdapter extends ArrayAdapter<Contact> {
/**
* #param context
* #param resource
* #param objects
*/
public SampAdapter(Context context, int resource, Contact[] objects) {
super(context, resource, objects);
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
return super.getView(position, convertView, parent);
}
#Override
public int getCount() {
return super.getCount();
}
}
and set yout adapter to your list view in fragment like this
SampAdapter ad=new SampAdapter(getActivity(), R.layout.your_root_view, YourArrayObject);
if its not working change to base adapter and write your own Constructor with Context,YourArrayObject and try.
I think this would help you make a java class adapter to call the items
public class DListViewAdapter extends ArrayAdapter<DListView> {
public DListViewAdapter(Context context, List<DListView> items) {
super(context, R.layout.listviewd, items);
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if(convertView == null) {
// inflate the GridView item layout
LayoutInflater inflater = LayoutInflater.from(getContext());
convertView = inflater.inflate(R.layout.listviewd, parent, false);
// initialize the view holder
viewHolder = new ViewHolder();
viewHolder.ivIcon = (ImageView) convertView.findViewById(R.id.icon);
viewHolder.tvTitle = (TextView) convertView.findViewById(R.id.title);
viewHolder.tvpoints = (TextView) convertView.findViewById(R.id.points);
convertView.setTag(viewHolder);
} else {
// recycle the already inflated view
viewHolder = (ViewHolder) convertView.getTag();
}
// update the item view
DListView item = getItem(position);
viewHolder.ivIcon.setImageDrawable(item.iconAdapter);
viewHolder.tvTitle.setText(item.titleAdapter);
viewHolder.tvpoints.setText(item.pointsAdapter);
return convertView;
}
private static class ViewHolder {
ImageView ivIcon;
TextView tvTitle;
TextView tvDescription;
}
}
create an listviewItem java class like this one i made for you :D
public class DListView {
public final Drawable iconAdapter;
public final String titleAdapter;
public final String pointsAdapter;
public DListView(Drawable icon, String title, String points) {
this.iconAdapter = icon;
this.titleAdapter = title;
this.pointsAdapter = points;
}
}
and create the layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/listViewD"
android:layout_centerHorizontal="true" />
</RelativeLayout>
and i kinda forgot what to put at the fragment be right back on it :(

Multiple click in listview android

I am doing an app which shows a database users. I want add differents actions depends on zone of click in each element.
This is my actually code for this list view:
<?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="wrap_content"
android:padding="5dp" >
<ImageView
android:id="#+id/logo"
android:layout_width="100px"
android:layout_height="100px"
android:layout_marginLeft="5px"
android:layout_marginRight="20px"
android:layout_marginTop="5px"
android:src="#drawable/icondatabase" >
</ImageView>
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.91"
android:text="Not users"
android:textSize="70px" />
<ImageView
android:id="#+id/imageAction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
</LinearLayout>
and this the class which creates list:
public class UsersArrayAdapter extends ArrayAdapter<String> {
private final Context context;
private final String[] values;
private final List<Bitmap> listImages;
private final String process;
public UsersArrayAdapter(Context context, String[] values,
List<Bitmap> listImages, String process) {
super(context, R.layout.users, values);
this.context = context;
this.values = values;
this.listImages = listImages;
this.process = process;
}
public UsersArrayAdapter(Context context, String[] values) {
super(context, R.layout.users, values);
this.context = context;
this.values = values;
this.listImages = null;
this.process = "";
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.users, parent, false);
TextView textView = (TextView) rowView.findViewById(R.id.label);
ImageView imageView = (ImageView) rowView.findViewById(R.id.logo);
ImageView imageView2 = (ImageView) rowView
.findViewById(R.id.imageAction);
textView.setText(values[position]);
if (listImages == null) {
imageView.setImageResource(R.drawable.iconenroll);
} else {
imageView.setImageBitmap(listImages.get(position));
if (process.compareTo("users") == 0) {
imageView2.setImageResource(android.R.drawable.ic_menu_delete);
}
if (process.compareTo("verify") == 0) {
imageView2.setImageResource(android.R.drawable.ic_media_play);
}
}
return rowView;
}
}
How can i do to if user clicks in imageaction do some action and if clicks in textview do other one?
thanks
you can set onclicklisteners for both textview and imageview . but you have to use ViewHolders.
static class ViewHolder{
ImageView imageone;
ImageView imagetwo;
TextView tvone;
}
in the adapter getview
final ViewHolder holder;
if(convertView == null){
convertView = layoutInflater.inflate(R.layout.custom_view_new, null);
holder = new ViewHolder();
........
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
holder.imageone.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
// do ur work
}
}
holder.tvone.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
// do ur work
}
}
By default textView is not clickable, you have to set android:clickable="true" in your textView.
textView.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO
}
});
imageView2.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO
}
});
Try this :
static class ViewHolder {
public TextView searchpageNameTextView;
public ImageView ivStar;
}
Inside getView method:
View rowView = convertView;
// reuse views
if (rowView == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
rowView = inflater.inflate(R.layout.demo, null);
// configure view holder
ViewHolder viewHolder = new ViewHolder();
viewHolder.searchpageNameTextView = (TextView) rowView.findViewById(R.id.tvName);
viewHolder.ivStar = (ImageView) rowView.findViewById(R.id.ivgstar);
rowView.setTag(viewHolder);
}
final ViewHolder holder = (ViewHolder) rowView.getTag();
holder.searchpageNameTextView.setText(text you want to set);
holder.image.setImageBitmap(your bitmap);
holder.searchpageNameTextView.setOnClickListener(do your stuffs);
holder.image.setOnClickListener(do your stuffs);
return rowView;
Above code is working fine. I implemented it in my app.
You can just setOnClickListeners for the respective elements in getView() of your custom BaseAdapter:
#Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater mInflater = (LayoutInflater)
context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
convertView = mInflater.inflate(R.layout.search_result_item, null);
}
final int fPos=position;
ImageView image1=(ImageView)convertView.findViewById(R.id.img1);
TextView tv1=(TextView)convertView.findViewById(R.id.tv1);
image1.setOnClickListener(new onClickListener(){
#Override
public void onClick(View v) {
Log.i("CustomAdapter", "List item "+ fPos +" had it's image clicked");
}
});
tv1.setOnClickListener(new onClickListener(){
#Override
public void onClick(View v) {
Log.i("CustomAdapter", "List item "+ fPos +" had it's text view clicked");
}
});
return convertView;
}
Sadly setting onClick methods of these views make the List Row itself un-clickable since they take all focus. If youw ant your whole row to be clickable and have a seperate action for that with an onItemClickListener of your ListView, you will have to add android:descendantFocusability="blocksDescendants" tag to the parent layout of the imageview/textview and set
android:focusable="false"
android:focusableInTouchMode="false"
for the ImageView and TextView in xml.

Categories