Android-布局问题-文本视图上中和下中

Android-布局问题-文本视图上中和下中,android,layout,center,textview,Android,Layout,Center,Textview,我有一个布局问题 假设我的屏幕底部出现一个RelativeLayout。在这里,我想添加两个文本视图,一个在中间,一个在上中间,一个在下中间 |--------------------------| | Text1 | | Text2 | |--------------------------| 类似这样的事情:-)这对你来说怎么样: <RelativeLayout xmlns:android="http://s

我有一个布局问题

假设我的屏幕底部出现一个RelativeLayout。在这里,我想添加两个文本视图,一个在中间,一个在上中间,一个在下中间

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

类似这样的事情:-)

这对你来说怎么样:

<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>

这对您有什么好处:

<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>


两个文本视图都显示在“水平中心”…他问“一个在上中心,一个在下中心”如果他想要的话,这会起作用,就像他在问题中画的文本图片一样。。。但是他消失了,所以我们永远也不会知道:)文本视图都出现在“水平中心”…他问“一个在上中心,一个在下中心”如果他想要的话,这会起作用,就像他在问题中画的文本图片一样。。。但他消失了,所以我们永远也不会知道:)你的问题是误导性的。你已经把“图像”放在屏幕的“中心水平”上了,我从中了解到你需要两个文本视图。相反,你应该把图像放在顶部,一个文本放在顶部bottom@Paresh-你能详细说明一下吗?我似乎很清楚他的要求,但不是你想说的…@Shouvik…他把没有按照他的要求显示的图像放在“一个文本视图在顶部中间,一个在底部中间”。我希望你明白了。你的问题是误导性的。你把“图像”放在从这开始我就知道,你们需要在屏幕的“中心水平面”上有两个文本视图……取而代之的是,你们应该把图像放在顶部,其中一个文本在顶部,另一个文本在顶部bottom@Paresh-你能详细说明一下吗?我似乎很清楚他的要求,但不是你想说的…@Shouvik…他把没有按照他的要求显示的图像放在“一个文本视图在顶部中间,一个在底部中间”。我希望你能理解