android-listview

ScrollView distrubing ListView inside of LinearLayout

孤人 提交于 2019-12-31 00:29:49
问题 I have LinearLayout whcih contains Buttons and ListViews. After getting many buttons and I decide to put that LinearLayout into ScrollView but after putting ScrollView my ListViews are showing only one Item. Following is the code before ScrollView <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingBottom="

Updating the List UI with Timer

僤鯓⒐⒋嵵緔 提交于 2019-12-30 11:53:43
问题 I am trying to update the list view with timer.I have implemented the android UI timer tutorial but my problem is how to use it for List view where i need to update the each row of list after a certain interval. how does the handler will update the each row of the list(i.e suppose a textview is inside the eachrow where i'll display the updated values.) public class ListAdapter extends BaseAdapter { private List<String> messages; private Context mContext; public ListAdapter(Context context ,

Updating the List UI with Timer

做~自己de王妃 提交于 2019-12-30 11:52:08
问题 I am trying to update the list view with timer.I have implemented the android UI timer tutorial but my problem is how to use it for List view where i need to update the each row of list after a certain interval. how does the handler will update the each row of the list(i.e suppose a textview is inside the eachrow where i'll display the updated values.) public class ListAdapter extends BaseAdapter { private List<String> messages; private Context mContext; public ListAdapter(Context context ,

Show alertDialog with radiobuttons when click a listViewItem

你说的曾经没有我的故事 提交于 2019-12-30 06:25:10
问题 I have a listView with 2 items in it, the 2 items are "seconds" and "minutes" When I press "seconds" I'd like a alertDialogBox to open en show 5,10,15,... seconds. Same when I press minutes Something like this: But I'm having trouble implementing it, because I don't understand very well how it is working. Here is the code I have: import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import

How to apply setItemChecked(position,true) with RecyclerView in Android?

試著忘記壹切 提交于 2019-12-30 06:18:11
问题 I am developing a Material Design Navigation Drawer. I've created a new class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener in it to handle the user's click on the list items. I use the class this way within the MainActivity class' onCreate method: mRecyclerView.addOnItemTouchListener( new RecyclerItemClickListener(this, mRecyclerView, new RecyclerItemClickListener.OnItemClickListener() { @Override public void onItemClick(View view, int position) {// do whatever if

how to change selected list item background, android

女生的网名这么多〃 提交于 2019-12-30 05:25:06
问题 I have two ListView 's in my Activity , when i select one from first List data will reflected to other list. I have done this part, its working fine for me. But I am struggling to change the background for selected item in first List , how can i do this? 回答1: You can do this by below - Set the android:listSelector="@drawable/selection" to your ListView's xml attribute. And, in your selection.xml contains the selector which will hold the change when you select any item from listview. selection

DialogFragment with custom ListView

六眼飞鱼酱① 提交于 2019-12-30 04:45:14
问题 I'm trying to create a DialogFragment that shows a dialog with a custom ListView inside. public class MultiSelectDialogCustom extends DialogFragment { ListView mLocationList; private ArrayList<String> mOfficeListItems = new ArrayList<String>(); public static MultiSelectDialogCustom newInstance(int title) { MultiSelectDialogCustom dialog = new MultiSelectDialogCustom(); Bundle args = new Bundle(); args.putInt("title", title); dialog.setArguments(args); return dialog; } @Override public View

Android ListView update with SimpleCursorAdapter

痞子三分冷 提交于 2019-12-30 03:26:17
问题 Hey i use a listview for demonstrate entries which are stored in a database. I also have a EditText element and a button which adds the content of the EditText into the Database. To bind the view to the database content i use the SimpleCursorAdapter and following populate function: private void populate() { cursor = dbAdapter.getAllItems(); startManagingCursor(cursor); String[] from = new String[] { DBAdapter.KEY_TASK }; int[] to = new int[] { android.R.id.text1 }; // Now create an array

ListView + ImageButton + descendantFocusability

安稳与你 提交于 2019-12-29 10:05:43
问题 I have a listview to which I add rows with 1 imagebutton .. I tried to set the imagebutton the setfocusable false but still not working .. item_list.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="160dp" android:descendantFocusability="blocksDescendants" android:id="@+id/RL_item"> <ImageButton android:layout_width="200dp" android:layout_height="fill_parent" android

ListView + ImageButton + descendantFocusability

半世苍凉 提交于 2019-12-29 10:03:30
问题 I have a listview to which I add rows with 1 imagebutton .. I tried to set the imagebutton the setfocusable false but still not working .. item_list.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="160dp" android:descendantFocusability="blocksDescendants" android:id="@+id/RL_item"> <ImageButton android:layout_width="200dp" android:layout_height="fill_parent" android