• 4.03Android学习


    一、今日学习

     今天是一和二

    1、隐藏android中EditText自带的的下划线

    1
    2
    android:background="@null"
    或android:background="@/drawable/bg_edittext_norma.xml"

    bg_edittext_norma.xml

    1
    2
    3
    4
    5
    6
    7
    8
    9
    <?xml version="1.0" encoding="UTF-8"?>
        <!--商品描述的可编辑框-->
        <solid android:color="#FFFFFF" />
        <corners android:radius="10dip"/>
        <stroke
            android:width="1dip"
            android:color="#BDC7D8" />
    </shape>
    1
    2
    3
    4
    5
    6
    7
    8
    <EditText
           style="?android:attr/textViewStyle"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:background="@null"
           android:hint="输入用户名"
           android:paddingBottom="5dip"
           android:paddingTop="5dip" />

     

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

    • 核心代码块1:

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

    1
    2
    android:imeOptions="actionSearch"
    android:singleLine="true"
    • 核心代码块2:

    Activity或者Fragment 要实现TextView.OnEditorActionListener接口

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    public class DrugCatalogueInquiryFragment extends GeneralSocialFragment implements TextView.OnEditorActionListener {
     
     private ClearEditText etDrugName;
     
     etDrugName = xFindViewById(R.id.et_drug_name);
     etDrugName.setOnEditorActionListener(this);
     
      @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            doWhichOperation(actionId);
            return true;
        }
     
        private void doWhichOperation(int actionId) {
            switch (actionId) {
                case EditorInfo.IME_ACTION_SEARCH:
                    //隐藏项目中弹框
                    hideSoftInputMethod();
     
                    //项目中个性化操作
                    getEditTextValue();
                    pageno = 1;
                    getMedicineListInfoForApp(name,firstWord,type,level,pageno);
                    break;
                default:
                    break;
            }
        }

    原文

    二、问题

     暂无

    三、明日计划

    继续今天这一part

  • 相关阅读:
    Git与GitHub关联
    利用GitHub上的SimpleMemory装扮博客园
    第5课第4节_Binder系统_C程序示例_测试与总结
    第5课第1节_Binder系统_C程序示例_框架分析
    第4课第4节_Android灯光系统_源码分析_电池灯
    第4课第3节_Android灯光系统_编写HAL_lights.c
    第2课第1节_Android灯光系统_led_class驱动
    第4课第1节_Android灯光系统_总体框架
    Android 优秀博客
    4.5节_Android硬件访问服务使用反射
  • 原文地址:https://www.cnblogs.com/zyljal/p/14908748.html
Copyright © 2020-2023  润新知