简体   繁体   English

无法更改线性布局(Xamarin.Android)中页面底部的按钮

[英]Unable to change button at bottom of page in Linear Layout (Xamarin.Android)

I am unable to put button at bottom of this Screen. 我无法在此屏幕底部放置按钮。 The listview should come on top while sign out button must appear at bottom just after the list view ends. 列表视图应该在列表视图的顶部,而退出按钮必须在列表视图结束后显示在底部。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top"
android:background="#29A586">
<Button
    android:text="Sign Out"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/SignOutButton" />

<ListView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/mylistView" />
</LinearLayout>

use button below listview with weight 使用列表视图下方的按钮进行加权

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="top"
    android:background="#29A586">
    <ListView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:id="@+id/mylistView" />
    <Button
        android:text="Sign Out"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/SignOutButton" />
    </LinearLayout>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM