Android:将textview固定在LinearLayout的中心

Android:将textview固定在LinearLayout的中心,android,android-layout,button,textview,android-linearlayout,Android,Android Layout,Button,Textview,Android Linearlayout,如何将TextView固定在其父线性布局的中心。和一个按钮,在空白b/w文本视图和右边缘的家长。(文本视图必须位于中间)。请帮帮我 |--------------------------------------------------------| <------Parent Linearlayout | MyTextviewInCenter BackButton| <------There should not be any

如何将TextView固定在其父线性布局的中心。和一个按钮,在空白b/w文本视图和右边缘的家长。(文本视图必须位于中间)。请帮帮我

|--------------------------------------------------------|  <------Parent Linearlayout

|                  MyTextviewInCenter          BackButton|  <------There should not be any gap b/w Button & its parent 
|--------------------------------------------------------|
|---------------------------------------------

>
您可以这样做


>

您可以这样做

将线性布局的方向设置为水平:

android:orientation="horizontal"
然后设置Textview的重心“中心”

最后设置按钮的左边距你想要什么

android:layout_marginLeft="25dp"

我想它可能会帮助你

设置线性布局水平方向:

android:orientation="horizontal"
然后设置Textview的重心“中心”

最后设置按钮的左边距你想要什么

android:layout_marginLeft="25dp"

我想它可能会帮助你

非常感谢。它起作用了。如果不使用Rel_布局,我们就不能这样做吗?我认为仅使用线性布局是不可能的。谢谢。它起作用了。如果不使用Rel_布局,我们不能做同样的事情吗?我认为仅仅使用线性布局是不可能的