0

私はAndroidを初めて使用しますが、それでもスマートフォンで問題なく動作するアプリを設計することができました。さまざまな画面サイズでのAndroidのサポートに関するチュートリアルを読んで、次のように思いました。より良い。" まあ、それがどのように正確に機能するのか理解できなかったようです。Android SDK内で仮想デバイスを使用することにより、小さい画面サイズでアプリを実行します。残念ながら、自動「スケーリング」は行われず、アプリのレイアウトの半分が画面に表示されません。私のスマートフォンでは画面の6分の1だったimageButtonは、おそらくこの新しい小さな画面の3分の1を占めています。何を忘れましたか?いくつかの説明や他の投稿を読みましたが、私が得た情報は、自動スケーリングが行われないことを示しているようでした...多分私はいくつかの基本的なルールを逃していますか?ありがとうございました

編集:ここでは、例としてコードを少し追加します。画面サイズが変わっても、ImageButtonがスマートフォンの画面全体に同じように表示されるようにするには、どのように変更すればよいですか?(可能であれば)。

<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:background="@drawable/greenbackground"
 tools:context=".GameFrame" >

  <ImageButton
    android:id="@+id/image1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_marginLeft="30dp"
    android:layout_marginTop="27dp"
    android:background="@android:color/transparent"
    android:clickable="false"
    android:contentDescription="@string/app_name"
    android:src="@drawable/empty" />

  <ImageButton
    android:id="@+id/image2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@+id/image1"
    android:layout_alignTop="@+id/image1"
    android:layout_marginLeft="16dp"
    android:background="@android:color/transparent"
    android:clickable="false"
    android:contentDescription="@string/app_name"
    android:src="@drawable/empty" />

<ImageButton
    android:id="@+id/image3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="14dp"
    android:layout_toRightOf="@+id/image2"
    android:layout_alignTop="@+id/image2"
    android:background="@android:color/transparent"
    android:clickable="false"
    android:contentDescription="@string/app_name"
    android:src="@drawable/empty" />

</RelativeLayout>
4

1 に答える 1

0

ScollView小さな画面では見えない UI 要素を表示するには、 を使用する必要があります。ScrollViewは子を 1 つしか持つことができないことに注意してください。

<ScollView
[...] >

  <MyParentLayout
   [...] >

      <MyUiElements
      [...] >

   </MyParentLayout>

</ScollView>
于 2013-02-03T23:23:41.737 に答える