开发者

Stacking a listview on top of a textview Android

In my开发者_开发知识库 activity I need a ListView on top of my TextView. How can I achieve such a thing?


I just did this with an ImageView thanks to some help from folks on SO. I created from my own class inheriting from BaseAdapter and then overrode the getView method of that class. Basically, what you end up doing is shoving your own view, which in your case would be a TextView inside the ListView via the getView method.

You can reference my implementation here.


If what you need is to have a listview and a textview, Try giving android:layout_weight="1" and android:layout_height="0px" for the listview and place the textview below the listview inside the same layout


Something like this:

<RelativeLayout>
     <TextView android:id="@+id/text"
               android:layout_alignParentBottom="true"
               android:layout_height="wrap_content" />
     <ListView android:layout_above="@id/text"
               android:layout_height="fill_parent" />
</RelativeLayout>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜