Android 为什么图像不';t填充宽度
我的main.xml中有以下内容:图像标记不能填充设备的宽度Android 为什么图像不';t填充宽度,android,imageview,android-layout,Android,Imageview,Android Layout,我的main.xml中有以下内容:图像标记不能填充设备的宽度 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_heigh
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:screenOrientation="portrait">
<ImageView
android:id="@+id/ImageView01"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="@drawable/marker">
</ImageView>
</LinearLayout>
试试看
还是退房
image_view_1.xml
在Android APIDemos中
这应该会有帮助。试试看
还是退房
image_view_1.xml
在Android APIDemos中
这应该会有所帮助。您已将ImageView的高度设置为
wrap\u content
。这意味着ImageView将只占用所选图像所需的空间。如果您想让它占据整个屏幕,只需将布局高度更改为fill\u parent
您还需要使用
android:scaleType=“”
选择ImageViewscaleType
,将ImageView的高度设置为wrap\u content
。这意味着ImageView将只占用所选图像所需的空间。如果您想让它占据整个屏幕,只需将布局高度更改为fill\u parent
您还需要使用
android:scaleType=“”
选择ImageViewscaleType
我确实设置了填充上述父级的宽度?我将检查scaleType。刚才它工作了。这个模拟器是有故障的,一半时间工作一半时间不工作。呃,我是说高度,对不起。我将在中编辑它。更改ImageView的高度。我已将宽度设置为填充上面的父对象?我将检查scaleType。刚才它工作了。这个模拟器是有故障的,一半时间工作一半时间不工作。呃,我是说高度,对不起。我将在中编辑它。更改您的ImageView的高度。我刚才测试它时,它工作正常。模拟器似乎有问题!我刚测试的时候,它工作了。看来模拟器是有缺陷的!