java - Android xml布局问题与小 View

标签 java android

我正在努力让这个布局看起来更好。一切都找到了,直到我添加到 list 中。从那时起,一切都有点缩小了。我添加uses minSdk指令的原因是为了允许qvga设备(例如wildfire)运行我的应用程序。

图像不会填充空间,它的中间或其 LinearLayout 父级相当小。

而且底部的图库非常小,因此很难单击图库中的项目。

有人有什么建议吗?

<?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>

最佳答案

您可以将该布局的权重设置为 1,以便它占据其余布局未使用的所有空间。

例如:

你的画廊占据了屏幕的 5%,顶部占据了另外 10%,其他一些东西又占据了 5%,权重为 1 的布局将占据屏幕的另外 80%。

如果这不是您正在寻找的内容,请说明:)

关于java - Android xml布局问题与小 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6860777/

相关文章:

java - 如果出现任何类型的异常,重定向到错误 Controller ?

android - 如何从十六进制颜色字符串中获取颜色

Java动态while表达式

java - maven发布时,pom.xml.releaseBackup和release.properties文件应该怎么处理?

Android Intent 调用联系人,而不是号码

android - 保存和共享图像 universal-image-loader

android - 使用 DiffUtil 更新 RecyclerView 中的单个项目

android - 一次调用多个 AsyncTask 在 Android 中不起作用

java - 无法解析符号 Mock 或 InjectMocks

JAVA 邮件客户端错误