我有一个带有imeOptions="actionSearch"
. 现在,当我单击 EditText 时,键盘不会在某些 HTC 设备中弹出,例如 HTC Desire S 和 HTC Incredible。EditText xml 如下:
<com.myapp.utilities.font.DroidSansEditText
android:id="@+id/txtSearchByName"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.60"
android:background="@drawable/edittext"
android:ellipsize="end"
android:gravity="left|center_vertical"
android:hint="@string/provider_practice"
android:imeOptions="actionSearch"
android:inputType="textCapWords"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:singleLine="true"
android:tag="byName"
android:textColor="#a19d93"
android:textSize="15.5sp" />
DroidSansEditText
是有的习俗EditText
。droid-sans font
DroidSansEditText 如下:
public class DroidSansEditText extends EditText {
public DroidSansEditTextView(Context context) {
super(context);
}
public DroidSansEditTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public DroidSansEditTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void setTypeface(Typeface tf, int style) {
if (!isInEditMode()) { //For Graphical layout of xml in eclipse
// here Bold style is handled. Same way we can handle italic style
if (style == 1) { // if bold (Style Constant, normal = 0 | bold = 1
// | italic = 2)
tf = Typeface.createFromAsset(getContext()
.getApplicationContext().getAssets(),
"DroidSans-Bold.ttf");
} else {
tf = Typeface.createFromAsset(getContext()
.getApplicationContext().getAssets(), "DroidSans.ttf");
}
super.setTypeface(tf, 0);
}
}
}