我试图让这个布局看起来更好。一切都被发现,直到我加入清单。从那时起,一切都有所收缩。我添加使用minSdk指令的原因是允许qvga设备(例如wildfire)运行我的应用程序。
图像不会填充空间,它在中间或其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>
答案 0 :(得分:3)
您可以使该布局的权重为1,这样就占用了其余部分未使用的所有空间。
所以例如:
你的画廊占据屏幕的5%,顶部占据另外10%,其他一些占用另外5%,重量为1的布局将占用屏幕的另外80%。
如果这不是你想要的,请说出来:)
答案 1 :(得分: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"/>
这应该可以解决您的问题。您也可以尝试其他API sdk版本而不是8适用于您的应用。