无法在底部添加按钮

时间:2018-07-14 18:04:07

标签: android xml

这是我的XML:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>myapp.wsdl</artifactId>
        <version>${project.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.glassfish.metro</groupId>
                <artifactId>webservices-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.glassfish.metro</groupId>
                <artifactId>webservices-rt</artifactId>
            </exclusion>
        </exclusions>
    </dependency> 
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>com.bean</artifactId>
        <version>${project.version}</version>
    </dependency>
    <dependency>
        <groupId>com.squareup.okhttp3</groupId>
        <artifactId>okhttp</artifactId>
        <version>3.10.0</version>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
        <type>jar</type>
    </dependency>
</dependencies>

我只想在<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".GetAttendanceFromDatabase" android:background="@drawable/animation_back_grad1" android:padding="5dp" android:orientation="vertical"> <TextView android:id="@+id/amHeading" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="0dp" android:layout_marginEnd="8dp" android:layout_marginStart="8dp" android:layout_marginTop="0dp" android:fontFamily="casual" android:text="Your Record" android:layout_gravity="center" android:textStyle="bold" android:textColor="@android:color/white" android:textSize="28sp" /> <TextView android:id="@+id/totalLectures" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:layout_marginEnd="8dp" android:layout_marginStart="8dp" android:layout_marginTop="0dp" android:text="Total Lectures Delivered : 10" android:textColor="@android:color/white" android:textSize="15sp" /> <ListView android:id="@+id/attendancRrecordList" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="0dp" android:layout_marginBottom="50dp" android:background="@color/custom_list_back" /> </LinearLayout> 下方添加一个退出按钮,但是当我编写按钮代码时,它会退出布局吗?

我在列表的底部留了一个空白,但仍然无法正常工作。 我尝试在内部布局中插入ListView,也尝试在内部布局中插入列表视图,但是没有任何效果!

this is I am getting

2 个答案:

答案 0 :(得分:0)

这会做好您的工作!

?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="5dp"
    android:orientation="vertical"
    android:weightSum="16">

    <TextView
        android:id="@+id/amHeading"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_marginTop="0dp"
        android:fontFamily="casual"
        android:text="Your Record"
        android:layout_gravity="center"
        android:textStyle="bold"
        android:textColor="@android:color/white"
        android:textSize="28sp"
        android:layout_weight="2"
        />

    <TextView
        android:id="@+id/totalLectures"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:text="Total Lectures Delivered : 10"
        android:textColor="@android:color/white"
        android:textSize="15sp"
        android:layout_weight="1"
        />

    <ListView
        android:id="@+id/attendancRrecordList"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginTop="0dp"
        android:layout_weight="11"
        />

    <Button
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:text="Exit Button"
        android:layout_weight="2"/>

</LinearLayout>

答案 1 :(得分:0)

使用权重复制此xml

jupyter notebook