Tag: listview

Animate list items in ListView

I try to animate new items in my ListView. I have stable id-s, so I know exactly which element to animate. The problem comes from the recycle mechanism of ListView. I call startAnimation on the View when I know I got a recently inserted element. But then, the view got recycled, filled with different data. […]

Columns in ListView Android

How can I make columns in Android ListView? I have this list item layout xml: <?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=”fill_parent” android:orientation=”horizontal”> <TextView android:layout_weight=”.3″ android:layout_width=”wrap_content” android:layout_height=”fill_parent” android:id=”@+id/hour” android:gravity=”center” /> <ImageView android:id=”@+id/symbol” android:scaleType=”fitCenter” android:layout_gravity=”center_horizontal” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_weight=”.5″ /> <TextView android:layout_weight=”.8″ android:layout_width=”wrap_content” android:layout_height=”fill_parent” android:id=”@+id/temperature” android:gravity=”center” /> <TextView android:layout_weight=”1″ android:layout_width=”wrap_content” android:layout_height=”fill_parent” android:id=”@+id/percipitation” android:gravity=”center” /> <TextView android:layout_weight=”1″ android:layout_width=”wrap_content” […]

Android TabLayout does not display contents anymore as soon as fragment is switched

I am using a navigation drawer in my project, with 5 fragments in it. In one fragment I have the in the design support library introduced TabLayout, which includes 2 Fragments. All works fine, except when I leave the fragment which has the TabLayout and switch back to it, all the content is gone. In […]

Filtered ListView onItemClick returns Item at original position

I have a listview with custom rows being populated from an custom BaseAdaptor. On click of any row, I open a new Activity. Everything was working fine until I added the filter functionality to this list. When I search the list and THEN click on an Item, it doesn’t open the activity associated with the […]

Why i can't lock DrawerLayout with layout gravity

I use DrawerLayout and recently i want to change gravity of listView in drawerLayout. But after i change gravity of listView to android:layout_gravity=”start|bottom”from android:layout_gravity=”start”, drawerLayout can’t be lock to mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); setDrawerLockMode() work with; <android.support.v4.widget.DrawerLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:id=”@+id/drawer_layout” android:layout_width=”match_parent” android:layout_height=”match_parent” > <RelativeLayout android:layout_width=”match_parent” android:layout_height=”match_parent” > </RelativeLayout> <ListView android:id=”@+id/drawer_list” android:layout_width=”320dp” android:layout_height=”match_parent” android:layout_gravity=”start” android:background=”#F3F3F4″ android:choiceMode=”singleChoice” > </ListView> But […]

ListView Viewholder checkbox state

I’ve some problems with my ListView custom adapter (and its newly implemented viewHolder). I have a ListView with a checkbox for each item (nothing new here). The problem is, if there is more than 9 items in my list, when I check the first checkbox, the tenth will be automatically checked (same for the second […]

Vertically center a text on a listview row

I’m trying to make a listview with a text and an image for each row. The image should be on the right and the text should ocupy the rest of the row. The text should be verticaly centered. I can do all this except the centered part. This is what I have after many failed […]

Sorting Android ListView

I’m only starting with Android dev, and while the Milestone is a nice device Java is not my natural language and I’m struggling with both the Google docs on Android SDK, Eclipse and Java itself. Anyway… I’m writing a microblog client for Android to go along with my Windows client (MahTweets). At the moment I’ve […]

ListView custom filter gives wrong item selected when filtered

I am new to Android programming and I have a ListView when filtered always return me the first item in the list, so how do I fix this? For instance, my list contains A.A, A.B, A.C, B.C, B.D. When I want to search the list for things starting with B, I will get B.C, B.D […]

How to set ImageViews source dynamically from ArrayList<String> with Drawable image name?

I have a ListView with an ImageView, a TextView and another ImageView in each row. The code below is the xml of my ListView row: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”horizontal” android:layout_width=”match_parent” android:layout_height=”60dp” android:background=”#FFF”> <ImageView android:id=”@+id/left” android:layout_width=”50dp” android:layout_height=”50dp” android:layout_gravity=”center” android:src=”@drawable/ic_default” android:layout_marginLeft=”10dp” android:layout_marginRight=”10dp” /> <TextView android:id=”@+id/text” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_gravity=”center” android:gravity=”center” android:layout_weight=”1″ android:textSize=”16sp” /> <ImageView android:id=”@+id/right” android:layout_width=”50dp” […]

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