Android 自定义Action Button
<EditText ? ??android:id="@+id/password" ? ??android:layout_width="match_parent" ? ??android:layout_height="wrap_content" ? ??android:imeOptions="actionDone" ? ??android:inputType="textPassword"?/>
有時(shí)可能需要自定義action button 的文字,如下
<EditText ? ? android:id="@+id/password" ? ? android:layout_width="match_parent" ? ? android:layout_height="wrap_content" ? ? android:imeActionId="@+id/action_sign_in" ? ? android:imeActionLabel="@string/sign_in_short" ? ? android:inputType="textPassword" />
在代碼中調(diào)用mEditText = (EditText) view.findViewById(R.id.password); mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { ? ?@Override ? ? public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { ? ? ? ? if (actionId == R.id.action_sign_in) { ? ? ? ? ? ? // Do sign in ? ? ? ? ? ? return true; ? ? ? ? } ? ? ? ? return false; ? ? } });
總結(jié)
以上是生活随笔為你收集整理的Android 自定义Action Button的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: android 倒计时的控件,以动画的形
- 下一篇: android 自定义控件(FloatL