I want to create a list that is similar in functionality to the Gmail application for Android. By this I mean that you can select lines by clicking on the image on the left or view the email by clicking elsewhere on the line. I can get closer, but thatβs not entirely true.
My custom string consists of ImageView on the left and some TextViews on the right. Here is the gist of getView on my adapter.
@Override public View getView(final int position, View convertView, ViewGroup parent) { View row = super.getView(position, convertView, parent); imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getListView().setItemChecked(position, !getListView().isItemChecked(position)); } }); row.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getActivity(), "" + position, Toast.LENGTH_SHORT).show(); } }); }
It's very close! There is no line highlighting in the string listener.
android android-listview listview
user140550 Aug 25 '13 at 5:38 on 2013-08-25 05:38
source share