C# Android-在布局中将按钮移到底部
我在将按钮与布局底部对齐时遇到一些问题。看这张照片: 正如你所见,我需要这个5按钮在我的布局底部。我该怎么做?我试着把重力放在底部,但没用。这是我的密码C# Android-在布局中将按钮移到底部,c#,android,android-layout,android-linearlayout,C#,Android,Android Layout,Android Linearlayout,我在将按钮与布局底部对齐时遇到一些问题。看这张照片: 正如你所见,我需要这个5按钮在我的布局底部。我该怎么做?我试着把重力放在底部,但没用。这是我的密码 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_he
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/background_light"
android:orientation="vertical"
android:weightSum="100">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="80">
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="25"
android:layout_marginTop="20dp"
android:text="- How much wood would a woodchuck chuck if a woodchuck could chuck wood?"
android:textAppearance="?android:attr/textAppearanceSmall"
android:background="@android:color/holo_blue_dark"
android:paddingTop="20dp"
android:paddingLeft="5dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="bottom">
<Button
android:id="@+id/btnA"
android:layout_height="60dp"
android:text="YOLO"
android:maxHeight="60dp"
android:minHeight="60dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="match_parent"
android:layout_weight="1"
android:textSize="10dp"
android:background="@android:color/background_dark"
android:layout_margin="10dp" />
<Button
android:id="@+id/btnB"
android:text=" asda sdas dasd asd asasdasdaCiaoaga gaerg aergae gr earg aerg aerg "
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="match_parent"
android:layout_weight="1"
android:textSize="10dp"
android:layout_height="match_parent"
android:background="@android:color/background_dark"
android:layout_margin="10dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="bottom">
<Button
android:id="@+id/btnC"
android:layout_height="60dp"
android:text="James Bond"
android:maxHeight="60dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:minHeight="60dp"
android:layout_width="match_parent"
android:layout_weight="1"
android:textSize="10dp"
android:background="@android:color/background_dark"
android:layout_margin="10dp" />
<Button
android:id="@+id/btnD"
android:layout_height="60dp"
android:text="Dunno"
android:maxHeight="60dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:minHeight="60dp"
android:layout_width="match_parent"
android:layout_weight="1"
android:textSize="10dp"
android:background="@android:color/background_dark"
android:layout_margin="10dp" />
</LinearLayout>
<Button
android:text="Change"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/btnCambia"
android:background="@android:color/holo_orange_dark" />
可以将它们添加到不同的布局和设置
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="bottom"
在textview的线性布局和按钮的线性布局之间添加一个空视图,如下所示:
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
将主linearlayout标记放入relativelayout中,然后将linearlayout的alignparentbottom设置为true。因此我必须在linearlayout中创建其他布局?我的意思是创建另一个线性布局或在线性布局中使用的任何类型的布局。您到底想要什么?给我详细解释一下,这样我就可以指导你了。那么除了詹姆斯·邦德·巴顿,你还需要阿斯达·巴顿,除了约洛,你还需要邓诺·巴顿?我说的对吗?我需要TextView下面的所有按钮都位于我的应用程序底部。这意味着哪个TextView?蓝色的?是的,我需要所有的纽扣约洛,詹姆斯·邦德,阿斯达萨,伙计,换到最下面