zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    201671010131 2016-2017-2 《Java程序设计》逐渐的进步。
    201671010131 2016-2017-2 《Java程序设计》走向核心。
    201671010131 2016-2017-2 《Java程序设计》艰难的旅程.
    201671010131 2016-2017-2 《Java程序设计》第二周 由简入繁的开始。
    201671010131 2016-2017-2 《Java程序设计》初学Java,所感所学总结。
    ajax提交请求数组时,参数名带[]
    天气接口-高德api
    Lambda 表达式在线程中的使用
    Centos7 下安装和配置 MinDoc
    天气接口 乱码问题
  • 原文地址:https://www.cnblogs.com/zyljal/p/14908748.html
Copyright © 2011-2022 走看看