2012-08-13 68 views
1

在我的应用程序我锁定屏幕方向为肖像。但我改变这一点,当用户点击一个编辑文本框。在纵向模式下它工作正常。但在横向模式下,编辑文本高度几乎是实际大小的两倍。下面是我编辑文本的xml。编辑文字高度增加,同时改变方向

<EditText 
     android:id="@+id/mylist_AddNewFFtext" 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_margin="5dp" 
     android:layout_weight="1" 
     android:background="@drawable/mylist_stdcenterelement" 
     android:imeOptions="actionSend|actionGo|actionDone" 
     android:inputType="text|textCapWords" 
     android:maxLength="1000" 
     android:padding="5dp" 
     android:textColor="@android:color/black" 
     android:textSize="14sp" 
     android:textStyle="bold" 
     android:visibility="visible" /> 

我已经删除了weight = 1属性,但它不起作用。我如何解决这个问题?

+0

变化的宽度和高度,以“wrap_parent”,这意味着该视图将刚刚够大包围其内容。 – 2012-08-13 11:42:23

+0

然后在我开始输入编辑框的大小之前会是零礼仪? – 2012-08-13 11:57:43

+0

不,它不会是零!试试看。 – 2012-08-13 12:01:47

回答

0
<EditText 
    android:id="@+id/mylist_AddNewFFtext" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_margin="5dp" 
    android:layout_weight="1" 
    android:background="@drawable/mylist_stdcenterelement" 
    android:imeOptions="actionSend|actionGo|actionDone" 
    android:inputType="text|textCapWords" 
    android:maxLength="1000" 
    android:padding="5dp" 
    android:textColor="@android:color/black" 
    android:textSize="14sp" 
    android:textStyle="bold" 
    android:visibility="visible" /> 

让你的布局高度0dp为wrap_content因为你试图插入文字0dp高度编辑文本框中

+0

这就是为什么我给重量属性。 – 2012-08-13 11:56:24