开发者

How to use as well android's layout to have perfect size on every phone with every screen size

开发者 https://www.devze.com 2023-04-10 17:22 出处:网络
I\'m thinking that google is fall down with layout for these phone. is more difficult understand layout than all the rest.

I'm thinking that google is fall down with layout for these phone. is more difficult understand layout than all the rest. My problem is to create layout for all the screen. First i have to set an image for background of activity and then put an imageview in the top with an imagebutton in the top right. I don't know why开发者_如何学Go when i use something like this:

<LinearLayout android:id="@+id/linearLayout1"
    android:layout_width="match_parent" android:orientation="horizontal"
    android:layout_height="match_parent" android:weightSum="1">
    <ImageView android:id="@+id/imageView1" android:src="@drawable/testotrova"
        android:layout_height="wrap_content" android:layout_weight="0.25"
        android:layout_width="256dip"></ImageView>
    <ImageButton android:layout_width="40dip"
        android:layout_weight="0.25" android:id="@+id/imageButton1"
        android:src="@drawable/info_mini" android:layout_height="50dip"
        android:layout_marginTop="10dip"
        android:scaleType="fitXY"></ImageButton>
</LinearLayout>

the imageview on emulator is ok but the board of imagebutton is more big than the image itself. i try scaletype but it don't change anything. When i try this layout on different phone with different screen size, HELL! in a little screen is ok, but in a screen bigger than the first the objects are more little, and posizioned in a bad way :( i've done all for my application but not layout, please help me!


I solved the problem using a LinearLayout and weight on every element in the layout!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号