2010-07-29 72 views
0

我有布局问题。Android - 布局问题 - 文字浏览顶部中心和底部中心

说我有一个RelativeLayout出现在我的屏幕底部。在这里,我想在中间添加2个文本视图,一个在顶部中心,另一个在底部中心。

|--------------------------| 
|   Text1   | 
|   Text2   | 
|--------------------------| 

类似的东西:-)

+0

你的问题是misguiding..you已经把从一开始我就知道,“图像”您需要在屏幕的“Center-hozontal”中输入2个文字视图......相反,您应该将包含一个TExt的图像放在顶部,一个文本放在底部 – 2010-07-30 04:34:55

+0

@Paresh - 您能否详细说明一下?我似乎明白他的要求,但不是你想说什么... – Shouvik 2010-07-30 04:46:08

+0

@Shouvik ...他把没有按照他的要求显示的图像“一个文本视图在顶部中心和一个在底部中心”..我希望你明白了 – 2010-07-30 04:53:09

回答

1

这个怎么样对你的工作:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:gravity="center_horizontal"> 
    <TextView android:id="@+id/text1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Text 1"/> 
    <TextView android:id="@+id/text2" 
       android:layout_below="@id/text1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Text 2"/> 
</RelativeLayout> 
+0

这两个textview出现在“中心水平”......他问“一个在顶部中心,一个在底部中心” – 2010-07-30 04:33:13

+0

这将工作,如果他想要它,就像他在问题中绘制的文本图片一样......但他消失了,所以我们永远不会知道:) – roundhill 2010-07-30 21:14:18

相关问题