我希望我的内容显示在此ScrollView中。此ScrollView位于CardView中。
<android.support.v7.widget.CardView
android:id="@+id/card_name"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_marginBottom="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
app:cardElevation="10dp"
app:cardBackgroundColor="#CCffffff"
app:cardCornerRadius="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_margin="15dp"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_gravity="top|center"
android:layout_height="match_parent">
<TextView
android:id="@+id/textviewhead"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorAccent"
android:textSize="20dp"
android:textStyle="bold"
tools:text="..." />
<TextView
android:id="@+id/textviewinfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textviewhead"
android:layout_marginTop="5dp"
android:textColor="@color/colorAccent"
android:textSize="16dp"
tools:text="..." />
<TextView
android:id="@+id/textviewinfo2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textviewinfo"
android:layout_marginTop="5dp"
android:textColor="@color/colorAccent"
android:textSize="16dp"
tools:text="..." />
</RelativeLayout>
</ScrollView>
</LinearLayout>
</android.support.v7.widget.CardView>
我也尝试了没有LinearLayout的情况,但这对我没有用。在AndroidStudio的预览中,还将显示内容,并且您也可以滚动。在模拟器或手机上尝试整个操作后,您只会看到白色的CardView。 我还尝试将“ match_parent”更改为“ wrap_content”,但我的手机仍然不显示任何内容。
我希望有人可以帮助我解决这个问题。 问候
杰瑞