android EditText:提示随inputType =“textCapCharacters”消失

时间:2012-10-03 19:52:36

标签: android xml

这可能是一个错误,或者我只是不明白为什么,但似乎在inputType="textCapCharacters"上设置EditText(或任何其他inputType)会使{{1}的提示消失}}

以下是我的xml的摘录,其中定义了以下图片中可见的gravity="center"

a)没有 LinearLayout

inputType="textCapCharacters"

结果

enter image description here

b) (...) <LinearLayout android:id="@+id/lin_cond1" android:layout_below="@id/v_cond_line1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:orientation="horizontal"> <RadioButton android:id="@+id/rb_cond_stake_normal" android:layout_width="0dp" android:layout_weight="15" android:layout_height="wrap_content" /> <TextView android:layout_width="0dp" android:layout_weight="25" android:layout_height="wrap_content" android:text="@string/define_stake" /> <EditText android:id="@+id/et_cond_enter_stake_normal" android:layout_width="0dp" android:layout_weight="20" android:layout_height="wrap_content" android:inputType="number" android:gravity="center" /> <EditText android:id="@+id/et_cond_currencies" android:layout_width="0dp" android:layout_weight="40" android:layout_height="wrap_content" android:maxLength="3" android:gravity="center" android:hint="@string/currency" /> </LinearLayout> (...)

inputType="textCapCharacters"

结果

enter image description here

我尝试过但没有奏效:
- 使提示文本也在大写字母中 - 将(...) <LinearLayout android:id="@+id/lin_cond1" android:layout_below="@id/v_cond_line1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:orientation="horizontal"> <RadioButton android:id="@+id/rb_cond_stake_normal" android:layout_width="0dp" android:layout_weight="15" android:layout_height="wrap_content" /> <TextView android:layout_width="0dp" android:layout_weight="25" android:layout_height="wrap_content" android:text="@string/define_stake" /> <EditText android:id="@+id/et_cond_enter_stake_normal" android:layout_width="0dp" android:layout_weight="20" android:layout_height="wrap_content" android:inputType="number" android:gravity="center" /> <EditText android:id="@+id/et_cond_currencies" android:layout_width="0dp" android:layout_weight="40" android:layout_height="wrap_content" android:inputType="textCapCharacters" android:maxLength="3" android:gravity="center" android:hint="@string/currency" /> </LinearLayout> (...) 放在不同的位置

什么有效,但不是很理想:
- (如此处所示)删除inputType="textCapCharacters"。但为什么它只能在组合中起作用?离开gravity="center"gravity没有正常工作。

那么有没有解决方案要求输入类型和重力?

0 个答案:

没有答案
相关问题