android EditText 去掉焦点和关闭软键盘


关闭软键盘 private void hideInputSoft() {
  try {
   InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(mContext.getWindow().getDecorView().getWindowToken(), 0);
  } catch (Exception e) {
   e.printStackTrace();
  }
 }


 private void hideInputSoft() {
  try {
   InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(mContext.getWindow().getDecorView().getWindowToken(), 0);
  } catch (Exception e) {
   e.printStackTrace();
  }
 } private void hideInputSoft() {
  try {
   InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
   imm.hideSoftInputFromWindow(mContext.getWindow().getDecorView().getWindowToken(), 0);
  } catch (Exception e) {
   e.printStackTrace();
  }
 }


 mDigits.setInputType(android.text.InputType.TYPE_NULL);//关闭软键盘

            android:focusable="true"
            android:focusableInTouchMode="true"//这个两个属性决定了编辑框的焦点去掉

 <LinearLayout
            android:id="@+id/contacts_input"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:visibility="invisible" 
            android:background="@drawable/dialbk"
            android:focusable="true"
            android:focusableInTouchMode="true"
            >


            <ImageButton
                android:id="@+id/saveButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:background="@drawable/btn_dial_save_xml"
                android:contentDescription="@string/description_delete_button"
                android:state_enabled="false" 
                android:layout_marginLeft="6dip"
                android:layout_marginRight="6dip"
                />


            <EditText
                android:id="@+id/digits"
                android:layout_width="0dip"
                android:layout_height="wrap_content"
                android:layout_gravity="right|center"
                android:layout_weight="1"
                android:background="@drawable/dial_input_text_bg_xml"
                android:contentDescription="@string/description_digits_edittext"
                android:drawableLeft="@drawable/ic_calllog_call_active"
                android:minWidth="140.0dip"
                android:paddingLeft="13.0dip"
                android:paddingRight="4.0dip"
                android:scrollHorizontally="true"
                android:drawablePadding="7dip"
                android:singleLine="true"
                android:textColor="@color/white"
                android:textSize="22sp" 
                />
            <!-- </LinearLayout> -->


            <ImageView
                android:id="@+id/deleteButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:background="@drawable/btn_dial_delete_xml"
                android:contentDescription="@string/description_delete_button"
                android:scaleType="centerCrop"
                android:state_enabled="false" 
                 android:layout_marginLeft="6dip"
                android:layout_marginRight="6dip"/>
        </LinearLayout>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值