0
我有一个listView里面的一个自定义ArrayAdapter呈现的MainActivity的片段。问题是由于某种原因,listview无法滚动。Android ListView在片段不滚动
我的XML MainActivity:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:design="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:screenOrientation="portrait"
tools:context=".MainActivity">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#f1f1f1">
</FrameLayout>
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
design:menu="@menu/navigation" />
</LinearLayout>
我的XML片段:
<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"
android:screenOrientation="portrait"
tools:context=".Friends">
<Button
android:id="@+id/newfriendbutton"
android:layout_width="0dp"
android:layout_height="66dp"
android:text="@string/new_friend"
tools:layout_constraintTop_creator="1"
tools:layout_constraintRight_creator="1"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintRight_toRightOf="parent"
tools:layout_constraintLeft_creator="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView6"
android:layout_width="395dp"
android:layout_height="wrap_content"
android:text="@string/instruct"
android:textAlignment="center"
app:layout_constraintTop_toBottomOf="@+id/newfriendbutton"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="8dp" />
<ListView
android:id="@+id/friendListView"
android:layout_width="match_parent"
android:layout_height="592dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView6"
tools:ignore="MissingConstraints"
tools:layout_constraintLeft_creator="1"
tools:layout_constraintRight_creator="1" />
</android.support.constraint.ConstraintLayout>
我想你应该尝试解决您的布局,'layout_height =“592dp”'不看的权利 –
没有那不是问题 – Jupiter
你真的应该使用权,没有固定的尺寸,虽然 –