Display text at the bottom of the screen in Android

In my application, I want to display a single TextView at the top of the screen with a screen width. Next, you need to display a graphical representation below this TextView. then display one text view below this graphic view.

I used the following xml code. In my code, TextView could not display screeen from below.

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <TextView android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" android:background="#FF8A11" android:padding="8dip" /> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <com.game.viewdot.ViewDot android:id="@+id/DrawView" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="bottom" android:layout_gravity="bottom" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Another Text View" android:background="#FF8A11" android:padding="8dip" android:gravity="bottom" android:layout_gravity="bottom" /> </LinearLayout> 

What modification do I want to put in this code to get my result ??????

+8
android layout textview
source share
4 answers

Instead of using LinearLayout as the parent layout, use Relative Layout. Try using the following code

  <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/relative01" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" android:background="#FF8A11" android:padding="8dip" android:id="@+id/textView01" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/textView01" > <com.game.viewdot.ViewDot android:id="@+id/DrawView" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_alignParentBottom="true" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Another Text View" android:background="#FF8A11" android:padding="8dip" /> </LinearLayout> </RelativeLayout> 

Hope this helps you ... :)

+7
source share

try it

 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_gravity="bottom"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/ContentView" android:layout_gravity="bottom" android:layout_alignParentBottom="true"/> </RelativeLayout> 
+13
source share

set all linear height

 android:layout_height="fill_parent" 
0
source share

set android: layout_height = "fill_parent" property for all View to expect TextView ....

0
source share

All Articles