Make Textview if list view is Empty

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Make Textview if list view is Empty

Postby venkatraman7 » Thu Aug 08, 2013 9:58 am

Hi All,
I am trying to make a textview to display text if my list view is empty. So by doing this I am getting my textview on top of the screen, but I want it in center. Below is my xml file...

Code: Select all
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
>

<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>

<TextView
android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/empty_callLog"
android:gravity="center" />



</RelativeLayout>


and before setting adapter to list view i am checking the size is zero.. if true I am using setEmptyView(textView) ... but it is comming on top of the screen


can anybody share some tweaks on how to comply this??

Thanks
Venkat
venkatraman7
Developer
Developer
 
Posts: 41
Joined: Tue Nov 16, 2010 6:47 am
Location: Puducherry

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot] and 4 guests