android - 来自 ScrollView -> 相对布局的内容未显示
问题描述
我希望我的内容显示在此 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”,但我的手机仍然没有显示任何内容。
我希望有人可以帮助我解决这个问题。亲切的问候
杰尔
解决方案
推荐阅读
- c# - klocwork 错误 - 在第 151 行检查为 null 的引用“SchoolDataSet”将在第 153 行取消引用
- ruby-on-rails - 我应该如何在 Rails 引擎中实现 ActiveStorage
- javascript - 如果未输入表单中的字段,php会显示一个警告框
- c# - SvcTraceViewer 未以红色显示异常
- cron - ' * ' 和 ' 有什么区别?'?
- python-3.x - 数据帧条目中一列与其他列的比较以提高数据质量
- android-studio - 修复警告:jks 密钥库使用专有格式。建议迁移到pkcs12
- ruby-on-rails - 多类别模型与具有 STI 的单类别模型?- 导轨
- google-cloud-platform - 仅使用 JSON API 检索 Google Cloud 对象的元数据?
- svg - SVG - 带有背景颜色和圆角边框的文本