android-listview

Adding different types of items a list view

微笑、不失礼 提交于 2019-12-09 18:22:48
问题 Is there a good tutorial or link that shows how to add different items to a listview? For example, one with two Text lines and a Check box , another that you just press and and something would pop up. All I have now is every list item is the same two line text view and checkbox... Or , if there is a way to add 1 row at a time with a different layout through R.layout.xxx ? public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRoot = inflater

ListView row styling - left aligned text, and right-aligned icon

倾然丶 夕夏残阳落幕 提交于 2019-12-09 18:06:23
问题 I'm trying to get ListView row to look like the following: | Text-Text-Text <ImageButton> | With the imagebutton snapped to the right edge. How can I do this? Here's the current layout code I'm using. What am I doing wrong? <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layercontainer" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="

Android Espresso ListView click item

[亡魂溺海] 提交于 2019-12-09 17:03:02
问题 I have ListView with pictures and text. When I try to click item, I get error android.support.test.espresso.AmbiguousViewMatcherException: 'with id: com.cifrasoft.telefm:id/cardsGridView' matches multiple views in the hierarchy. Problem views are marked with '****MATCHES****' below. I use the following code: onData(hasToString(startsWith("Item Text"))) .inAdapterView(withId(R.id.cardsGridView)) .perform(click()); Can I click ListView using position of Adapter , without matches or startWith ?

requestLayout() improperly called by android.widget.RelativeLayout android

余生颓废 提交于 2019-12-09 16:26:41
问题 i have implemented listview customadapter when displaying listview it showing below warring how to reslove it . requestLayout() improperly called by android.widget.RelativeLayout{b42acc20 V.E..... ......ID 0,-52-480,0 #7f0700ec app:id/ptr_id_header} during layout: running second layout pass java code public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context

Android: visible ListView images flicker when adding data to ArrayAdapter

久未见 提交于 2019-12-09 16:02:11
问题 I have a custom adapter which extends ArrayAdapter, it implements the view holder patterns to show data (text + image) from a web service. for lazy loading of the images I use the async tasks pattern from the advanced training in the Android's developers site, I also use disk + ram bitmap cache. when there is additional data to be retrieved I add a footer view that clicking on it retrieves additional data from the web service and add it to the adapter. the problem is that when this new data

How to get data from custom adapter in ListView?

拜拜、爱过 提交于 2019-12-09 15:59:05
问题 here is my problem : I created a custom adapter for my ListView and I get information out of a List that I give to that adapter in order to let him fulfill my ListView. He does everything correctly. Now I'd like to implement an OnItemClickListener and to get the data from it. But in that list I have 4 TextViews ... How can I retrieve the data ? I already know how to get the id and position since I display them in a Toast. Thanks a lot for your help ! Here is the custom Adapter : public class

How to animate text change in TextView?

岁酱吖の 提交于 2019-12-09 14:38:35
问题 Trying to do the following: animTimeChange = AnimationUtils.loadAnimation(this, android.R.anim.slide_in_left); itemTime.startAnimation(animTimeChange); itemTime.setText("new text"); but the animation happens thru blank screen (i.e. original text is cleared, then new text appears with animation). How to avoid that blank screen? (my TextView is part of ListView row, I've tried to use TextSwitcher - it doesn't work properly; for ViewFlipper - I am not sure where add Views there, since this is

How to get ViewSwitcher to wrap only the currently displayed view height?

好久不见. 提交于 2019-12-09 14:29:18
问题 I'm using a ViewSwitcher that lets me easily flip back and forth between two different List Headers with Animations built in. However, the problem is the two views are of greatly varying height and it appears that the ViewSwitcher with layout_height="wrap_content" , measures both children and takes the greater of the two heights as its own. This results in a large amount of unwanted blank space immediately below the smaller view when it is showing. I understand why this is desired

Reorder elements of ListView by dragging [duplicate]

最后都变了- 提交于 2019-12-09 13:48:15
问题 This question already has an answer here : Bauerca drag-sort-listview simple example (1 answer) Closed 4 years ago . I see it done a lot lately on android: I can drag an item in a listView to another position in the list. But I can't seem to find any example code. Does anyone have some example code they don't mind sharing. I have been reading http://developer.android.com/guide/topics/ui/drag-drop.html, but I am not making much progress. Complication So I find what seems to be a simple way to

Android L: Fast scroll for the RecyclerView

元气小坏坏 提交于 2019-12-09 13:35:14
问题 I'm trying to use RecyclerView in my application with lots of data in it and would like to make a fast scroll for it, just like for the ListView . Approach from this answer worked for me with ListView , but does not work for the RecyclerView . Even if I set fast scroll to true in RecyclerView layout, it still does not work: <android.support.v7.widget.RecyclerView android:id="@+id/recycler_view" android:scrollbars="vertical" android:layout_width="match_parent" android:layout_height="match