android-listview

Why is my custom layout file not recognized?

两盒软妹~` 提交于 2019-12-11 04:35:58
问题 I created a file in \res\layout named contactlist.xml But it is not recognized in my code: SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, //android.R.layout.simple_list_item_1, mContacts, //if cre8 own layout, replace "simple_[etc]" //android.R.layout.simple_list_item_checked, mContacts, // or simple_list_item_multiple_choice //android.R.layout.simple_list_item_multiple_choice, mContacts, android.R.layout.contactlist, mContacts, // <- contact list ist xml-non-grata new String[]

Avoid ImageView hover state inside Listview if List Item is pressed

好久不见. 提交于 2019-12-11 04:24:35
问题 I have a ImageView inside listview in left most position.This imageView and listView has all states (pressed ,selected,focused,normal).If I click ListView but not ImageView then in some devices the hover state(selected,focused,pressed) of ImageView is called. So I want to know how to avoid this. 回答1: Here are the steps to resolve this issue. Create a class called NoParentPressImageView with the following code: public class NoParentPressImageView extends ImageView { public

Using ViewBinder for a custom ListView item with TextView

天涯浪子 提交于 2019-12-11 04:14:45
问题 I'm trying to add a background color for an TextView on my ListView using a SimpleCursorAdapter with ViewBinder , but it doesn't work: listrow.xml: <TextView android:id="@+id/catcolor" android:layout_width="4dp" android:layout_height="match_parent" android:layout_margin="4dp" android:background="#FF0099FF" /> <LinearLayout android:paddingTop="4dp" android:paddingRight="4dp" android:paddingLeft="4dp" android:paddingBottom="2dp"> <TextView android:id="@+id/title" android:text="{title}" android

How to add an icon to a listview in a fragment

给你一囗甜甜゛ 提交于 2019-12-11 04:09:09
问题 I made a listview in a fragment. Now I need to add a simple icon to the listview items. The icon must be the same on every item. This will be a simple arrow (imageview). Is this possible with the listview I made? And if yes, how do I do it? So like this format: My text here --space--space-- > The code for the fragment: public class BiblioFragment extends Fragment { final String[] items = new String[] { "Astma en alcohol", "Astma en huisdieren", "Astma en lichaamsgewicht", "Astma en ouder

ListView scrolls to top when typing in multi-line EditText

橙三吉。 提交于 2019-12-11 04:08:16
问题 I create a simple ListView where each row is an EditText . Here is my R.layout.item : <?xml version="1.0" encoding="utf-8"?> <EditText xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textMultiLine"> </EditText> Notice how the EditText allows multi-line input through the android:inputType="textMultiLine" flag. By means of an ArrayAdapter I populate the ListView with a number of rows such that

How to use results from a Firebase query to ultimately populate a ListView in Android Studio

被刻印的时光 ゝ 提交于 2019-12-11 04:06:12
问题 I found that my ListView is not updated when the app is run because the adapter is set before the Firebase query occurs. First Question: Is there anyway to set a listener for query completion? This way I can set the adapter there instead. I know some Firebase methods auto-generate onComplete() / onSuccess() listeners. For debugging purposes I can trigger an update to the ListView by re-entering onResume() . This is where I receive an error message: The content of the adapter has changed but

Android Custom dialog inflating from layout - alignment issue

本秂侑毒 提交于 2019-12-11 04:04:08
问题 I have an custom dialog, whick i am inflating from dialog.xml. when I open the dialog it looks something like shown below. I am getting some space between listview and the (OK) button below it. I want to eliminate this space between the list view and the Button below it. How can i do this,? dialog.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout1" android:layout_width="wrap_content" android:layout_height="fill_parent" > <ListView

Color of listview item is very faint

若如初见. 提交于 2019-12-11 03:58:31
问题 Sorry if i am repeating the question. I am reading SMS/s from inbox and showing them in the listview. I can see the SMS/s in the listview as listview item after execution. Only problem is that, the text color of listview item is vary pale.(text i am getting is not readable/visible). I tried to change it, but nothing happened. How i can change this color to black or to any other color ? Here is my activity_view_task.xml : <RelativeLayout xmlns:android="http://schemas.android.com/apk/res

Wrong row deleted from custom listview with spinner

拥有回忆 提交于 2019-12-11 03:55:16
问题 I'm working on app that contains a custom ListView with a remove button that I update from the main activity. I have an issue removing a row from the ListView, although I'm deleting the right index from the custom list view and call notifyDataChanged() method, GUI does not update correctly. Here I wrote a sample project, like my real one in the idea just more sample: activity_main.xml (main layout) contains ListView only called listview. listview_row.xml contains two Spinners (student name

List view Focus while using D-PAD

柔情痞子 提交于 2019-12-11 03:54:22
问题 In my Image there is a sidebar and ListView there, I access every Button by using D-PAD. When side bar search button has focus and I press right D-PAD button, I want the focus to go to the ListView's first item. But, in my case it goes to the second item. If Down arrow has focus and i press right button it goes to 4th list item.So , i need to prevent this also.How to move the focus to the 1st one? if (Search != null && Search.hasFocus()) { // Search.setNextFocusRightId(R.id.listView); //