Tag: listview

Android ListView with OnItemClickListener AND GestureDetector

I have a the following ListActivity: public class ShowDayActivity extends ListActivity implements OnItemClickListener { private GestureDetector gestureDetector; private View.OnTouchListener gestureListener; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.day); registerForContextMenu(getListView()); gestureDetector = new GestureDetector(new MyGestureDetector()); gestureListener = new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } }; getListView().setOnItemClickListener(this); getListView().setOnTouchListener(gestureListener); } @SuppressWarnings(“static-access”) […]

Height of ListView fills the whole screen, although set as wrap_content

i have this ListView inside a LinearLayout: <?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” android:orientation=”vertical” > <TextView …/> <EditText /> … </EditText> <ListView android:id=”@+id/words_list” android:layout_width=”match_parent” android:layout_height=”wrap_content” > </ListView> </LinearLayout> The List is populated programmatically by a SimpleCursorAdapter: adapter = new SimpleCursorAdapter(this, R.layout.list_row_search, mCursor, from, to); list_row_search has a TableLayout with two TableRows: <?xml version=”1.0″ encoding=”utf-8″?> […]

Android: Create ListView in XML?

I want to create a list view with limited set of items that isn’t really going to change. Each row is going to have an image on the left and text on the right. (Just like in the Settings app) Can I populate that in XML (i.e. avoid writing code) ?

Android :EditText loses content on scroll in ListView?

I have list item with EditText in it, I don’t know how many items there will be. I have a problem when I enter some text in EditText, and then scroll down a ListView, after I’ve scroll up again there is no text in my first EditText, or there is some text from other EditText […]

Android ==> ListView stay selected?

I have a list view full of items, after the users selects an item it lights up, and then it goes back to normal. Is there a way to make it so that when the user selects an item in my ListView it stays selected, and highlighted?

How to use setTag and getTag with custom adapter

I get stucked and I need help. I’m trying to use set and get Tag but i can’t get how it works for this action: I’m using list view to show images loaded to extended adapter The custom Adapter inflate a layout with imageview_1, textview_1 and button_1 On my principal activity, I have a “Public […]

Android: EfficientAdapter with two different Views

I’m using an extended version of BaseAdapter based on the EfficientAdapter example from the SDK demo samples. My data is basically an object (ListPlaces) which holds an ArrayList with the actual list of places, accessible via listPlaces.getValues(). This ArrayList data is sorted by range and the ArrayList consist of some special items (separators), with no […]

ListView inside a ScrollView

Possible Duplicate: Listview inside ScrollView is not scrolling on Android I have a ListView inside a ScrollView and the problem is that the ScrollView is scrolling but ListView doesn’t scroll. I think this is happening because of that ScrollView. Does anyone have a solution for this issue?

Use android.R.layout.simple_list_item_1 with a light theme

I have learned that when using android:entries with a ListView, it uses android.R.layout.simple_list_item_1 as the layout for a list item and android.R.id.text1 as the ID of the TextView inside that layout. Please, correct me if I’m wrong. Knowing this, I wanted to create my own adapter but use the same layout resources, in order to […]

Why is my ListView not showing anything?

I have a very basic ListView in android and had set a very basic adapter. My problem is that the list view does not show anything, regardless of the adapter and the notifyDataSetChanged(); Here is my code: XML: <?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”> <TextView android:text=”@string/app_name” android:layout_width=”wrap_content” android:layout_height=”wrap_content” ></TextView> <ListView android:id=”@+id/selectView” android:layout_height=”wrap_content” android:layout_width=”wrap_content”> </ListView> […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.