为什么图像不补的宽度 [英] Why image don't fill width

查看:152
本文介绍了为什么图像不补的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的在我main.xml中继图像标记没有填满设备的宽度?

 <?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:方向=垂直
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    机器人:screenOrientation =肖像>< ImageView的
    机器人:ID =@ + ID / ImageView01
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_width =FILL_PARENT
    机器人:SRC =@绘制/标记>
< / ImageView的>< / LinearLayout中>


解决方案

你有你的ImageView的高度设置为 WRAP_CONTENT 。这意味着,作为由您选择图像所需要的ImageView的只需要尽可能多的空间。如果你希望它采取了整个屏幕,只是改变你的layout_height为 FILL_PARENT

您还需要选择一个ImageView的 scaleType 的android:scaleType =

I have the following in my main.xml the image marker does not fill the width of the device?

<?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>

解决方案

You have your ImageView's height set to wrap_content. This means the ImageView will only take as much space as is needed by the image you select. If you want it to take the entire screen, just change your layout_height to fill_parent.

You'll also want to select an ImageView scaleType with android:scaleType="".

这篇关于为什么图像不补的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆