在ImageView中wrap_content失效
代码如下
<?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"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="点餐START!!" android:textColor="#000fff" android:textSize="40sp" android:background="#fff000"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="姓名"/> <EditText android:layout_width="100dp" android:layout_height="wrap_content" android:hint="姓名" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="性别"/> <RadioGroup android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="男"/> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="女"/> </RadioGroup> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="喜好"/> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="辣"/> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="海鲜"/> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="酸"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="预算"/> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:text="0元" android:layout_weight="1" android:textAlignment="textEnd"/> <SeekBar android:layout_width="0dp" android:layout_height="wrap_content" android:max="100" android:min="0" android:layout_weight="4"/> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:text="100元" android:layout_weight="2"/> </LinearLayout> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="寻找菜品" android:textSize="25sp"/> <ImageView android:layout_width="180dp" android:layout_height="wrap_content" android:src="@drawable/hongshaorou" /> <ToggleButton android:layout_width="match_parent" android:layout_height="wrap_content" android:textOn="寻找" android:textOff="下一个"/> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="ssss"/> </LinearLayout>
就是ImageView那里的宽高显示不对,效果如下
蓝色边框的即为ImageView
然后那张图片如下
谢谢了,Orz
19
收起
正在回答 回答被采纳积分+1
1回答
Android从界面到数据存储2018版
- 参与学习 504 人
- 提交作业 1003 份
- 解答问题 1044 个
本专题是专为有Java语言基础想入坑Android开发的同学们准备的。从AndroidUI基础一直到网络,数据存储,一步到位入门Android开发。如果你会Java,那就不要犹豫了~ ~
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星