BottomAppBar对齐不正确

时间:2018-11-19 15:09:32

标签: android scroll android-bottomappbar

我将BottomAppBar与FloatingActionButton一起使用,但是,条的对齐方式存在问题。

我有两个问题; 1.尽管该栏被配置为对齐到底部并位于textview之后,但它覆盖了textview组件(id = question_id)(位于其顶部)。 2.条形图没有出现在屏幕底部,需要向下滚动才能看到它...我正在寻找一种浮动的底部条形,您也可以始终在屏幕底部看到它滚动时...

这是XML布局:条形图和textview是最后3个组件...

 <?xml version="1.0" encoding="utf-8"?><!-- question_fragment.xml -->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mainPracticeView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"
android:fillViewport="true"
android:layoutDirection="rtl">
<androidx.coordinatorlayout.widget.CoordinatorLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="false"
        android:orientation="vertical"
        android:paddingLeft="5dp"
        android:paddingRight="5dp"
        android:paddingBottom="20dp">

        <TextView
            android:id="@+id/question_content"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:clickable="false"
            android:gravity="start"
            android:textAlignment="textStart"
            android:textColor="#33b5e5"
            android:textSize="25sp"
            android:textStyle="bold" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingTop="15dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="1."
                android:textColor="@color/black"
                android:textSize="25sp" />

            <CheckBox
                android:id="@+id/ans1_checkbox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="25sp" />

            <TextView
                android:id="@+id/answer1_content"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/black"
                android:textSize="25sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingTop="10dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="2."
                android:textColor="@color/black"
                android:textSize="25sp" />

            <CheckBox
                android:id="@+id/ans2_checkbox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="25sp" />

            <TextView
                android:id="@+id/answer2_content"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/black"
                android:textSize="25sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingTop="10dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="3."
                android:textColor="@color/black"
                android:textSize="25sp" />

            <CheckBox
                android:id="@+id/ans3_checkbox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="25sp" />

            <TextView
                android:id="@+id/answer3_content"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/black"
                android:textSize="25sp" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingTop="10dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="4."
                android:textColor="@color/black"
                android:textSize="25sp" />

            <CheckBox
                android:id="@+id/ans4_checkbox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="25sp" />

            <TextView
                android:id="@+id/answer4_content"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/black"
                android:textSize="25sp" />

        </LinearLayout>

        <LinearLayout
            android:id="@+id/answer5_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingTop="10dp"
            android:visibility="gone">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="5."
                android:textColor="@color/black"
                android:textSize="25sp" />

            <CheckBox
                android:id="@+id/ans5_checkbox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="25sp" />

            <TextView
                android:id="@+id/answer5_content"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/black"
                android:textSize="25sp" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/answer6_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingTop="10dp"
            android:visibility="gone">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="6."
                android:textColor="@color/black"
                android:textSize="25sp" />

            <CheckBox
                android:id="@+id/ans6_checkbox"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textSize="25sp" />

            <TextView
                android:id="@+id/answer6_content"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/black"
                android:textSize="25sp" />
        </LinearLayout>

        <TextView
            android:id="@+id/question_id"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="end"
            android:paddingTop="12dp"
            android:text="id"
            android:textColor="@color/grey"
            android:textSize="25sp" />
    </LinearLayout>

    <com.google.android.material.bottomappbar.BottomAppBar
        android:id="@+id/bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        app:navigationIcon="@drawable/ic_menu_24" />
 <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/fab"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/baseline_publish_black_24dp"
            app:layout_anchor="@id/bar" />
    </androidx.coordinatorlayout.widget.CoordinatorLayout>
</ScrollView>

0 个答案:

没有答案
相关问题