简体   繁体   中英

imagebutton for different screen size

I have a problem with supporting screen size for ImageButton.
when adding ImageButton the image is much bigger than the screen size and half of it is outside the screen limit.
I tried by changing the size for every image, but in (4 inches screen size) the image appears smaller than other screens size .

is there any way I can make from xml, not to add many differet size to dpi folder

Hopefully someone can help.
thanks a lot

main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:paddingBottom="@dimen/activity_vertical_margin"
   android:paddingLeft="@dimen/activity_horizontal_margin"
   android:paddingRight="@dimen/activity_horizontal_margin"
   android:paddingTop="@dimen/activity_vertical_margin"
   android:background="@drawable/walla"
   tools:context=".MainActivity" >

<FrameLayout
   android:id="@+id/frameLayout1"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:layout_alignParentBottom="true"
   android:layout_centerHorizontal="true" >

   <ImageButton
     android:id="@+id/imageButton1"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:layout_marginBottom="154dp"
     android:background="@null"
     android:src="@drawable/hex_button_one" />

</FrameLayout>

</RelativeLayout>

这就是为什么制作了不同的dpi文件夹,以便图像每次在不同的屏幕上都会更改大小的原因。.确保将其放在图像的右侧文件夹中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM