【发布时间】:2019-08-10 06:41:39
【问题描述】:
我无法使用列表视图滚动。我尝试过使用weight = 1、focusable = true、nestedScrollingEnabled = true 的线性布局(但我没有nestedscrollview,所以这对我来说没用)。提前致谢
<com.google.android.material.card.MaterialCardView
android:id="@+id/materialCardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="5dp"
android:backgroundTint="@android:color/transparent"
app:cardCornerRadius="10dp"
app:cardElevation="10dp"
app:cardPreventCornerOverlap="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/topbtns">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorAccent">
<ListView
android:id="@+id/openedCallsLv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view" />
【问题讨论】:
-
这个问题可能是使用
wrap_content出现的。你能给0dp你的身高吗? -
MaterialCardView和ListView应该在ConstraintLayout内。
标签: android android-layout listview