EditText怎么在Android中使用

  介绍

本篇文章给大家分享的是有关EditText怎么在Android中使用,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

Android是什么

Android是一种基于Linux内核的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由美国谷歌公司和开放手机联盟领导及开发。

1,隐藏Android中EditText自带的的下划线

Android:背景=癅null"   或android:背景=癅/可拉的/bg_edittext_norma.xml"

bg_edittext_norma。xml

& lt; ? xml  version=?.0“,编码=癠TF-8" ?比;   & lt; shape  xmlns: android=癶ttp://schemas.android.com/apk/res/android"比;   ,,,& lt; !——商品描述的可编辑框——比;   ,,,& lt; solid  android:颜色=? FFFFFF",/比;   ,,,& lt; corners  android:半径=?0 dip"/比;   ,,,& lt;中风   ,,,,,,,android:宽度=? dip"   ,,,,,,,android:颜色=? BDC7D8",/比;   & lt;/shape> & lt; EditText   ,,,,,,   ,,,,,,android: layout_width=皐rap_content"   ,,,,,,android: layout_height=皐rap_content"   ,,,,,,android:背景=癅null"   ,,,,,,android:提示=笆淙胗没?   ,,,,,,android: paddingBottom=? dip"   ,,,,,,android: paddingTop=? dip",/在

2,让软键盘出现搜索按钮

 EditText怎么在android中使用“> </p> <p> <img src= <李>

核心代码块1:

这俩个一定要设置,要不然软键盘不会出现搜索

android: imeOptions=癮ctionSearch"   ,,,,,,,,,,,,,,,android:单行模式=皌rue" <李>

核心代码块2:

活动或者片段要实现TextView。OnEditorActionListener接口

public  class  DrugCatalogueInquiryFragment  extends  GeneralSocialFragment  implements  TextView.OnEditorActionListener  {      ,private  ClearEditText  etDrugName;=,,etDrugName  xFindViewById (R.id.et_drug_name);   ,etDrugName.setOnEditorActionListener(这个);      @Override才能   ,,,public  boolean  onEditorAction (TextView  v, int  actionId,, KeyEvent 事件),{   ,,,,,,,doWhichOperation (actionId);   ,,,,,,,return 真实;   ,,,}      ,,,private  void  doWhichOperation (int  actionId), {   ,,,,,,,switch  (actionId), {   ,,,,,,,,,,,case  EditorInfo.IME_ACTION_SEARCH:   ,,,,,,,,,,,,,,,//隐藏项目中弹框   ,,,,,,,,,,,,,,,hideSoftInputMethod ();      ,,,,,,,,,,,,,,,//项目中个性化操作   ,,,,,,,,,,,,,,,getEditTextValue ();   ,,,,,,,,,,,,,,,pageno =, 1;   ,,,,,,,,,,,,,,,getMedicineListInfoForApp(名称、firstWord类型、级别、pageno);   ,,,,,,,,,,,,,,,休息;   ,,,,,,,,,,,默认值:   ,,,,,,,,,,,,,,,休息;   ,,,,,,,}   ,,,}      }

3,多行EditText的时候会出现光标在中间的问题:

关键代码

android:重力=發eft" & lt; EditText ,,   ,,,android: layout_width=癿atch_parent",,   ,,,android: layout_height=皐rap_content",,   ,,,android: minLines=?“,,   ,,,android:背景=? ffffff",,   ,,,android: paddingLeft=? dp",,   ,,,android:重力=發eft",/在

像这种。这是什么原因造成的呢?用来EdittText默认是重力是中心。null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null

EditText怎么在Android中使用