【问题标题】:Android spinner doesn't really fill widthAndroid微调器并没有真正填充宽度
【发布时间】:2012-01-06 13:59:20
【问题描述】:

我在RelativeLayout 中有一个非常简单的TableLayout。其中一行包含一个设置为“fill_width”的微调器。在模拟器中,这看起来应该是这样,但在我的手机上,它的左右两侧距离全宽都有几个像素。表中的下一行按应有的方式填充。还尝试将微调器移到桌子外,但没有任何改变...

有人有什么建议吗?

<?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:orientation="vertical" >

    <TableLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:stretchColumns="0"
        android:shrinkColumns="0" 
        >
        <TableRow>
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_span="3"
                android:layout_marginTop="10dip"
                android:text="@string/project_prompt" 
            />          
        </TableRow>
        <TableRow>
            <Spinner 
                android:id="@+id/spinner"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_span="3"
                android:prompt="@string/project_prompt"  
            />
        </TableRow>
        <TableRow>
            <Button
                android:id="@+id/button_addproject"
                android:layout_height="wrap_content"
                android:layout_width="0dip"
                android:layout_weight="1"
                android:text="Ny"
                android:onClick="selfDestruct" 
            />
            <Button
                android:id="@+id/button_modifyproject"
                android:layout_height="wrap_content"
                android:layout_width="0dip"
                android:layout_weight="1"
                android:text="Rediger"
                android:onClick="selfDestruct" 
            />
            <Button
                android:id="@+id/button_deleteproject"
                android:layout_height="wrap_content"
                android:layout_width="0dip"
                android:layout_weight="1"
                android:text="Slett"
                android:onClick="selfDestruct" 
            />  
        </TableRow>         
    </TableLayout>
    <Button
    android:id="@+id/button_connect"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_centerInParent="true"
        android:text="@string/connect"
    />

    <ImageView 
        android:src="@drawable/image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerInParent="true"
    />    
</RelativeLayout>

【问题讨论】:

  • 你能发布你的布局 XML 吗? ..我可以在我的设备上为你试一试..

标签: android width spinner


【解决方案1】:

我没有解决方案,但可以确认。我刚刚在我的设备和模拟器上的一个我自己的应用程序中检查了它。就我而言,这并没有那么糟糕,但你可以看到不同之处。

我认为这是系统 UI 的本质。我认为微调器使用的是 9 个补丁图像,如果这个定义了填充,我认为你无能为力。例如。按钮在我的设备上的行为方式相同。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-07-06
    • 2014-10-27
    • 2013-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-09
    • 1970-01-01
    相关资源
    最近更新 更多