Android - ExpandableListView 内容在屏幕底部被截断
Android - ExpandableListView content cut off at bottom of screen
我是 Android 的新手,所以我可能只是在做一些愚蠢的事情,但这就是我的 table 的样子:
我以为只是底部导航栏覆盖了内容,但是当我在底部导航栏在设备上而不是屏幕上的设备上测试它时,我遇到了同样的问题。这是我的 XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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=".TipActivity">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="?android:attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:layout_constraintTop_toTopOf="parent"/>
<ExpandableListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tip_list_view"
app:layout_constraintTop_toBottomOf="@id/toolbar">
</ExpandableListView>
</android.support.constraint.ConstraintLayout>
我发现了问题。通过将 Toolbar 和 ExpandableListView 置于垂直线性布局中并保持其他所有内容不变,视图可以正确匹配。
我是 Android 的新手,所以我可能只是在做一些愚蠢的事情,但这就是我的 table 的样子:
我以为只是底部导航栏覆盖了内容,但是当我在底部导航栏在设备上而不是屏幕上的设备上测试它时,我遇到了同样的问题。这是我的 XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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=".TipActivity">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="?android:attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:layout_constraintTop_toTopOf="parent"/>
<ExpandableListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tip_list_view"
app:layout_constraintTop_toBottomOf="@id/toolbar">
</ExpandableListView>
</android.support.constraint.ConstraintLayout>
我发现了问题。通过将 Toolbar 和 ExpandableListView 置于垂直线性布局中并保持其他所有内容不变,视图可以正确匹配。