如何使用以及Android的布局,以每个手机的每个手机的完美尺寸与每个屏幕尺寸

问题描述:

我在想,谷歌是与这些手机的布局摔倒。比其他人更难理解布局。 我的问题是为所有屏幕创建布局。 首先,我必须为活动的背景设置图像,然后在右上方用imagebutton将imageview放在顶部。我不知道为什么,当我使用这样的事情:如何使用以及Android的布局,以每个手机的每个手机的完美尺寸与每个屏幕尺寸

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

模拟器上的ImageView的是确定,但ImageButton的董事会比图像本身更大。我尝试scaletype,但它不会改变任何东西。 当我在不同屏幕尺寸的不同手机上尝试此布局时,嘿!在一个小屏幕上是好的,但在比第一对象更小,并在一个糟糕的方式posizioned大屏幕:(我已经做了所有我的应用程序,但没有布局,请帮帮我!

+0

你究竟想要什么,在顶部中间和右上角有一个imageview的布局?如果你不想要图像板的按钮,使用一个简单的ImageView的或按钮。 – blessenm

+0

我相信如果有一个简单的解决方案来封装从你所有的细节,Android的家伙肯定会做到这一点。有许多不同的Android设备中,如果你想针对大多数,你需要进行一些工作。 – Egor

我在布局的每个元素上使用LinearLayoutweight解决了这个问题!