增加一个布局屏幕的底部 [英] Adding a Layout to the bottom of the screen
本文介绍了增加一个布局屏幕的底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下的XML布局。
I have the following XML layout.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip" >
<TextView
android:id="@+id/itemNumber"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_marginRight="6dip"
android:textSize="50px"/>
<TextView
android:id="@+id/secondLine"
android:layout_width="fill_parent"
android:layout_height="26dip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_toRightOf="@id/itemNumber"
android:ellipsize="marquee"
android:singleLine="true"
android:textSize="12sp" />
<TextView
android:id="@+id/firstLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/secondLine"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignWithParentIfMissing="true"
android:layout_toRightOf="@id/itemNumber"
android:gravity="center_vertical"
android:textSize="16sp" />
<RelativeLayout
android:id="@+id/InnerRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:text="Submit"
android:id="@+id/Button"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Button>
<EditText
android:id="@+id/EditText"
android:layout_width="fill_parent"
android:layout_toLeftOf="@id/Button"
android:layout_height="wrap_content">
</EditText>
</RelativeLayout>
</RelativeLayout>
我需要做的是使编辑文本和放大器;该按钮显示在屏幕的底部。我使用的是3次的文本显示为一个列表视图。因此,我可以从其中选择一个列表,并输入到编辑文本提交值。
What i need to do is make the Edit Text & the Button to appear in the bottom of the screen. I'm using the 3 Text Views to appear as a List View. So i can choose one from the list and enter it into the Edit Text to submit the value.
但我不能让'时间出现在底部。我怎样才能做到这一点?
But I cannot make 'em appear in the bottom. How can i do this?
推荐答案
替换
android:layout_height="?android:attr/listPreferredItemHeight"
通过
android:layout_height="match_parent"
//看看这个布局:
// Take a look at this layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="textView 1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="textView 2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="textView 3" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="submit" />
</LinearLayout>
</RelativeLayout>
这篇关于增加一个布局屏幕的底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文