0

由于相当多的设备屏幕尺寸,我在某个图像附近的 ImageButtons 定位存在问题。可以将所有内容定位为 1 或 2 个屏幕尺寸,但不能再定位,因为它会定位在错误的位置。我已经为这个问题寻找了任何解决方案,并发现优化所有图像可能会distances programmatically but a lot of programmmatical properties require 11 API for it. My app should work with 2.2, 2.3 versions too. Another solution is the creating of layout qualifiers but there is some screen sizes where my imageButtons position a bit wrongly and this way demand to create a lot of files, folders. Could you recommend me something interesting in this issue? Something what is more optimal and doesn过多地消耗设备性能。我尝试实现这张图片http://s018.radikal.ru/i507/1209/07/e3f1024a5780.jpg

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rlInjury"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:padding="10dp" >

<ImageView
    android:id="@+id/imMonkey"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="fitCenter"
    android:scaleX="0.8"
    android:scaleY="0.8"
    android:src="@drawable/monkey" />

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:orientation="vertical" >

        <ImageButton
            android:id="@+id/ib1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@android:color/transparent"
            android:scaleType="fitCenter"
            android:src="@drawable/pointer1" />

        <ImageButton
            android:id="@+id/ib2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@android:color/transparent"
            android:scaleType="fitCenter"
            android:src="@drawable/pointer3" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:orientation="vertical" >

        <ImageButton
            android:id="@+id/ib4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@android:color/transparent"
            android:scaleType="fitCenter"
            android:src="@drawable/pointer2" />

        <ImageButton
            android:id="@+id/ib5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@android:color/transparent"
            android:scaleType="fitCenter"
            android:src="@drawable/pointer2" />
    </LinearLayout>
</LinearLayout>

4

1 回答 1

0

在我看来,您应该为每个屏幕尺寸的设备创建布局 (xml) 文件,例如 layout-small、layout-large、layout-medium。我认为没有这样的方法。

于 2012-09-16T15:17:33.653 回答