android - Height of a listview -
i have been trying make layout app, set android:layout_height="wrap_content"
.
this code ::
<scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.hp.money.dashboard"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.cardview android:id="@+id/cv_amount_display" android:layout_width="match_parent" android:layout_height="200dp"> ..... </android.support.v7.widget.cardview> <android.support.v7.widget.cardview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" card_view:cardcornerradius="10dp"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/last_10_transaction" /> <listview android:id="@+id/last_transactions_lv" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" /> </linearlayout> </android.support.v7.widget.cardview> </linearlayout> </scrollview>
i using listview inside scrollview, bad idea, know! leads scrolling issues, believe. have dynamically update data on screen during runtime, , think listview can handle it. if there's other view
it, please suggest.
now, problem if data source of listview has 10 items, height of listview remains equal size of 1 listview element, height of listview set wrap_content
, supposed resize accordingly. doesn't! how fix this?
this how looks, though listview has 10 items! listview 1 has heading last 10 transactions
why used scrollview??
i put scrollview, because, number of enteries in listview can many, want when user scrolls see entries not visible int listview, whole page gets scrolled, , not listview.
what mean " dynamically insert data listview during runtime". if modifying list data dynamically listview
can handle internally. no need in case. can remove scrollview
works fine.
Comments
Post a Comment