-1

Androidで複数の画面サイズのレイアウトを修正するための最良のルートを探しています。ローンチの準備がほぼ整った素晴らしいアプリがあります..しかし、私のパートナーの1人がSamsungタブレットで試してみましたが、アイコンといくつかの機能が小さすぎます

だから私は何を考えていたのですか?画面サイズで解像度を変更しますか、それとももっと簡単な方法がありますか?

これが私のレイアウトコードです


    <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:tools="http://schemas.android.com/tools"
xmlns:pj="http://schemas.android.com/apk/res/com.example.waysecure"
xmlns:bm="com.example.waysecure"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"     xmlns:android="http://schemas.android.com/apk/res/android">
<Button
    android:id="@+id/button_pannic"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/pannic"
    android:visibility="visible" />
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="bottom"
    android:layout_marginTop="50dp" >
    <WebView
        android:id="@+id/webView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <FrameLayout
        android:id="@+id/Fofo"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </FrameLayout>
    </RelativeLayout>
 <SlidingDrawer
 android:id="@+id/sg_below"
 android:layout_width="match_parent"
 android:layout_height="275dp"
 android:layout_gravity="bottom"
 android:layout_marginTop="200dp"
 android:content="@+id/content"
 android:handle="@+id/handle" >
<Button android:layout_width="match_parent" android:layout_height="60dp" android:id="@+id/handle" android:background="@drawable/tray_handle_normal" />
<RelativeLayout
    android:id="@+id/content2"
    android:layout_width="wrap_content"
    android:layout_height="282dp"
    android:background="#aa000000" >
        </RelativeLayout><TabHost  android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent">
   <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="bottom"
            android:background="#aa000000" >
 <LinearLayout android:id="@+id/tab1" android:layout_width="match_parent" android:layout_height="match_parent">


            </LinearLayout>
              <GridView
                  android:id="@+id/tab2"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_gravity="bottom"
                  android:columnWidth="90dp"
                  android:gravity="center"
                  android:horizontalSpacing="1dp"
                  android:numColumns="auto_fit"
                  android:stretchMode="columnWidth"
                  android:verticalSpacing="1dp" > 
            </GridView>  <LinearLayout android:id="@+id/tab3" android:layout_width="match_parent" android:layout_height="match_parent">
                  <com.carouseldemo.controls.Carousel android:id="@+id/carousel2" android:layout_width="match_parent" android:layout_height="match_parent" android:animationDuration="200" pj:Items="@array/entries" pj:Names="@array/names" pj:SelectedItem="0" pj:UseReflection="true">
                </com.carouseldemo.controls.Carousel>  
            </LinearLayout>
        </FrameLayout>
    <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top" >
        </TabWidget>
    </TabHost>
</SlidingDrawer>
</merge>
4

5 に答える 5

2

このための方法を構成しました。私にとって、それはヒットとトライアルの方法でした。私が最初のAndroidアプリケーションを開発していたときに同じ問題が発生しましたが、最終的にはそれを釘付けにしました。すべての画面解像度を完全にサポートするには、フルスクリーン画像の場合、解像度の異なる4つの画像を作成します。

hdpi: 480*800
ldpi: 320*460
mdpi:720*960
xhdpi: 800*1280

アプリが両方の方向をサポートしている場合は、横向きモードに異なるレイアウトを作成し、同じ名前でレイアウトランドに配置します。関連情報はこのリンクにあります。

于 2013-02-28T07:20:09.623 に答える
2

あなたがしなければならない唯一のことは<support-screens> 、あなたmanifestとその下 に を追加することです<support-screens>

 <supports-screens android:resizeable=["true"| "false"]
              android:smallScreens=["true" | "false"]
              android:normalScreens=["true" | "false"]
              android:largeScreens=["true" | "false"]
              android:xlargeScreens=["true" | "false"]
              android:anyDensity=["true" | "false"]
              android:compatibleWidthLimitDp="integer"
              android:largestWidthLimitDp="integer"/>

一貫したレイアウトを作成するためのヒント:

  1. 、などのlayoutパラメータをハードコーディングしないでください。widthheight
  2. px" "は使用しないでください。spテキスト サイズには " dp" を使用しlayout-widthlayout-heightなどには " " を使用します。
  3. RelativeLayoutandを使用し、非推奨であるLinearLayoutため使用しないでください。AbsoluteLayout
  4. singleView をサポートするため、ScrollView必要に応じて使用します。layouts

詳細については、Support Multiple Screensの Android 開発者ドキュメントを確認してください。

于 2013-02-28T07:04:55.957 に答える
1

res フォルダーに layout_size フォルダーを作成する必要があります

さまざまなサイズの画面に対して、さまざまな xml ファイルを作成します。

于 2013-02-28T07:24:35.730 に答える