Android listview shows elements at the bottom when there is few elements?
When the size of elements is few,like 1,2 or 3 in a Listview It shows elements at the bottom.How can I make it to show elements at the top even there are few? Here's a screenshot.
Here's my xml code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="h开发者_JAVA技巧orizontal"
android:layout_width="match_parent"
android:padding="4px"
android:paddingBottom="4px"
android:background="@drawable/fbbar"
android:layout_height="50dip">
<EditText android:id="@+id/searchText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="bottom"
android:hint="type to search..."
android:drawableRight="@drawable/ic_search_text"/>
<Button android:id="@+id/btn_contacts_refresh"
android:layout_width="0px"
android:layout_height="0px"
android:drawableTop="@drawable/refresh"/>
</LinearLayout>
<ListView android:id="@+id/contactsList"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:transcriptMode="alwaysScroll"
android:background="#fff"
android:cacheColorHint="#00000000"
android:dividerHeight="1px" android:divider="#777a"/>
<LinearLayout
android:layout_height="2dip"
android:layout_width="match_parent"
android:orientation="horizontal"
android:background="@drawable/fbbar">
</LinearLayout>
</LinearLayout>
i think you problem is here android:transcriptMode="alwaysScroll"
精彩评论