• 3月17日学习日志


    今天学习了自动完成文本框的使用。

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context=".MainActivity">
    
        <AutoCompleteTextView
            android:id="@+id/atv_content"
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:completionHint="请输入搜索内容"
            android:completionThreshold="1"
            android:dropDownHorizontalOffset="5dp" />
    
        <MultiAutoCompleteTextView
            android:id="@+id/matv_content"
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:completionThreshold="1"
            android:dropDownHorizontalOffset="5dp"
            android:text="" />
        
    </LinearLayout>
    public class MainActivity extends AppCompatActivity {
    
        private AutoCompleteTextView atv_content;
        private MultiAutoCompleteTextView matv_content;
    
        private static final String[] data = new String[]{
                "小猪猪", "小狗狗", "小鸡鸡", "小猫猫", "小咪咪"
        };
    
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            atv_content = (AutoCompleteTextView) findViewById(R.id.atv_content);
            matv_content = (MultiAutoCompleteTextView) findViewById(R.id.matv_content);
    
    
            ArrayAdapter<String> adapter = new ArrayAdapter<String>(MainActivity.
                    this, android.R.layout.simple_dropdown_item_1line, data);
            atv_content.setAdapter(adapter);
    
            ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_dropdown_item_1line, data);
            matv_content.setAdapter(adapter);
            matv_content.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
        }
    }
  • 相关阅读:
    怎么打jar包 jar怎么运行
    ORACLE directory 目录
    materialized view 和snapshot
    OS级别kill 进程
    ORA01843 not a valid month
    物化视图 Materialized View
    oracle数据字典
    在oracle中如何退出edit模式
    Oracle临时表
    Oracle 查看 对象 持有 锁 的情况 (添加了V$SQL视图,这样可以一起查出具体导致这种锁的SQL语句,一次性就搞定了)
  • 原文地址:https://www.cnblogs.com/20193925zxt/p/14883174.html
Copyright © 2020-2023  润新知