EditText中的My Touch 4g文本垂直居中太高

时间:2011-07-03 20:53:28

标签: android android-layout

我有一位MyTouch 4g用户提交了以下屏幕截图(抱歉无法发布图片):

Bad format

据说480x800。在模拟器中使用480x800一切正常:

Good format

这是相关的xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:orientation="vertical">
        <TableRow android:background="@drawable/gradient_row"
            android:paddingTop="4dip">
            <TextView 
                android:id="@+id/outDiameterLabel" 
                android:paddingTop="6dip" 
                android:paddingRight="5dip"
                android:layout_gravity="right" 
                android:layout_height="40dip"
                android:layout_width="wrap_content" 
                android:textColor="#FFFFFF" 
                android:textSize="15dip"
                android:text="@string/outDiameterLabel" />
            <EditText 
                android:id="@+id/outExactDiameter"
                android:layout_height="40dip" 
                android:layout_width="wrap_content"
                android:gravity="center" 
                android:focusable="false" 
                android:numeric="decimal" />
            <EditText 
                android:id="@+id/outRoundedDiameter"
                android:layout_height="40dip" 
                android:layout_width="wrap_content"
                android:gravity="center" 
                android:focusable="false" 
                android:numeric="decimal" />
        </TableRow>
    </TableLayout>
</LinearLayout>
</ScrollView>

它似乎也在宽度上偏离。如果查看底部的输入,请注意右侧的最后一个按钮是如何截断的。其余的,宽度还可以。我不知道图像是如何捕获的,它是452 x 640.他的手机:HTC MyTouch 4G,Android 2.2.1,内核2.6.32.21-g899d047,Build 1.17.531.2 CL277036 release-keys,软件编号7.17.531.2 浏览器版本WebKit 3.1。他还试过卸载并重新安装。

我无法在我拥有的任何设备或模拟器中重现这一点。除了购买或借用myTouch 4g之外,是否有任何想法可以修复?

凯文

1 个答案:

答案 0 :(得分:2)

对于这些字段,40dip看起来不合适,文本会被EditText的9补丁背景的内容边界剪切。上面的Spinner小部件在两个屏幕截图中都被截断,这就是为什么右边的小向下箭头有奇怪的形状而不是干净的三角形。

有两种简单的选择。您可以放松对受影响字段的40dip高度限制,并使用wrap_content代替。这是适合您情况的最简单(也可能是最好的)方法。

或者,您可以为受影响的小部件创建自己的样式,包括您自己的9个补丁,用于聚焦,禁用,按下等状态。这样可以保证字段的视觉效果和指标与所有设备上的高度限制兼容。

相关问题