2017-03-26 235 views
-1

enter image description hereenter image description here增加图像的大小ImageView的

内通过增加图像尺寸仅宽度和imageview的高度是越来越增加,不过,我需要提高的实际图像即加注形象不只是背景越来越大(如附图所示)

此外,我希望这个可点击的图像采取手机的全部宽度和手机屏幕高度的1/3,这怎么可能?

由于

+1

你试过了吗?发布你的XML – rafsanahmad007

+0

Daniyal

+0

这是我的xml, ,但仍然在这个xml中,问题与imageview中的图像相比更小,并且随着您增加图像视图,然后只增加背景大小而不是整个图像,如上图所示... – Daniyal

回答

1

尝试这种情况:

用于图像使用:android:scaleType="fitXY"

和用于在屏幕使用的三分之一的Android weightsumlayout_weight

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:weightSum="3"> 

    <ImageButton 
     android:id="@+id/image_button" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:background="@android:color/transparent" 
     android:scaleType="fitXY" 
     android:src="@android:drawable/ic_menu_add" 
     android:visibility="visible" /> 

</LinearLayout> 

输出:

enter image description here

+0

是的工作......但图像越来越模糊。 – Daniyal

+0

是因为图像的分辨率?我应该用更高的dp下载吗? – Daniyal

+0

是的,你应该使用更高分辨率的图像......因为你想增加它的宽度和高度..如果它有帮助,标记答案是正确的... Thankx – rafsanahmad007