首页 新闻 会员 周边

Android Studio 使用ImageView时不显示布局

0
[已解决问题] 解决于 2021-04-06 11:00

就是我用别的组件,Design中都会显示布局的样子,但是ImageView就不显示,有人知道是咋回事吗
这是xml的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/test7_ImV1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/cat1"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/test7_btn1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="资源图片"
android:onClick="btn"/>
<Button
android:id="@+id/test7_btn2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="在线图片"
android:onClick="btn"/>
<Button
android:id="@+id/test7_btn3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="绘制图片"
android:onClick="btn"/>
</ImageView>
</LinearLayout><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/test7_ImV1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_weight="1"
android:scaleType="fitXY"
android:src="@drawable/cat1"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/test7_btn1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="资源图片"
android:onClick="btn"/>
<Button
android:id="@+id/test7_btn2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="在线图片"
android:onClick="btn"/>
<Button
android:id="@+id/test7_btn3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="绘制图片"
android:onClick="btn"/>
</ImageView>
</LinearLayout>
这是布局

木三136的主页 木三136 | 初学一级 | 园豆:159
提问于:2021-04-06 10:55
< >
分享
最佳答案
0

知道哪里错了,应该用LinearLayout的地方我用成了ImageView

木三136 | 初学一级 |园豆:159 | 2021-04-06 10:59
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册