2011-07-28 16 views
0

このレイアウトをより見栄えようとしています。マニフェストに追加するまではすべてが見つかりました。それ以来、すべてがちょっと収縮しています。 use minSdkディレクティブを追加したのは、私のアプリを実行するwildfireなどのqvgaデバイスを許可するためです。小さい表示のAndroid xmlレイアウトの問題

イメージはスペースを埋めることはなく、中央のほうが小さいか、LinearLayout Parentです。

また、下部のギャラリーは非常に小さく、ギャラリー内のアイテムをクリックするのが難しくなっています。

誰か提案がありますか?

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#ffffff"> 

<LinearLayout 
android:id="@+id/header" 
android:layout_alignParentTop="true" 
android:layout_width="fill_parent" 
android:layout_height="100px" 
android:background="#ffffff"> 
<TextView 
android:text="header" 
android:id="@+id/name" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:textColor="#000000" 
android:textAppearance="?android:attr/textAppearanceLarge" 
android:layout_marginLeft="10px"></TextView> 
</LinearLayout> 

<LinearLayout 
android:id="@+id/footer" 
android:layout_alignParentBottom="true" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"> 
<Gallery xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/examplegallery" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:background="#ffffff" /> 
</LinearLayout> 

<LinearLayout 
android:id="@+id/body" 
android:layout_below="@id/header" 
android:layout_above="@+id/scrollView1" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"> 
<!-- Whatever your body is --> 
    <ImageView 
    android:src="@drawable/icon" 
    android:layout_width="fill_parent" 
    android:layout_gravity="center" 
    android:id="@+id/imageView1" 
    android:layout_height="120dp"></ImageView> 

    </LinearLayout> 

    <TableRow android:layout_height="wrap_content" 
     android:layout_width="wrap_content" android:id="@+id/tableRow1" android:layout_above="@+id/scrollView1" android:layout_alignParentLeft="true"> 

    <TextView 
    android:text="price" 
    android:id="@+id/price" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textColor="#09bade" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:layout_marginRight="20px" 
    android:layout_marginLeft="10px" 
    ></TextView> 
    <TextView 
    android:text="quickcode" 
    android:id="@+id/quickcode" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textColor="#ff8400" 
    android:layout_marginRight="20px" 
    > 
    </TextView> 
    <TextView 
    android:text="stock" 
    android:id="@+id/stock" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textColor="#ff8400" 

    ></TextView> 
    </TableRow> 

    <ScrollView android:id="@+id/scrollView1" android:layout_width="wrap_content" android:layout_height="150px" android:layout_above="@+id/footer" android:layout_marginLeft="10px" android:layout_marginBottom="10px"> 
    <TextView 
    android:text="scroll" 
    android:id="@+id/summary" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textColor="#000000" 
    android:textAppearance="?android:attr/textAppearanceMedium" 
    android:layout_marginLeft="10dip"></TextView> 
    </ScrollView> 
    <Button android:id="@+id/button1" android:layout_height="wrap_content" android:text="Wishlist" android:layout_width="wrap_content" android:layout_alignBottom="@+id/tableRow1" android:layout_alignParentRight="true"></Button> 
</RelativeLayout> 

答えて

3

レイアウトの重みを1にすると、残りの部分が使用されていないすべての領域が占有されます。

はそう例えば:

あなたのギャラリーは、画面の5%をとり、トップは別の10%を取り、いくつかの他のものは、別の5%かかり、体重1を持っているあなたのレイアウトはあなたの他の80%がかかります画面。

これは、あなたがそう言うてください:)

+0

ありがとう、すぐにこれを試してみようbbs – brux

+0

imageviewにlayout_weight = "1"を追加しようとしましたが、それは不幸にも違いはありません。親LinearLayoutに同じ画像を追加するときと同じです。 – brux

+0

wierd、私には、レイアウトが取り込まれていない残りの画面をカバーするようにしたいときにコードが動作します。おそらくweightSumを使用してみますか? – Androider

0

試して、次のコードをAndroidManifest.xmlを

<uses-sdk android:minSdkVersion="8" 
       android:targetSdkVersion="8" /> 

次のオプションからアプリの

、適切なオプションで探していたものではない場合...

<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:requiresSmallestWidthDp="integer" 
        android:compatibleWidthLimitDp="integer" 
        android:largestWidthLimitDp="integer"/> 

これは問題を解決するはずです。また、あなたのアプリに該当するものとして、8ではなく他のAPI SDKバージョンを試すこともできます。

+0

これはOPまったく –

関連する問題