android studio3.3.1代碼提示忽略大小寫的設(shè)置
跟以往設(shè)置有區(qū)別,此處為取消紅框勾選,設(shè)置即可
補(bǔ)充知識(shí):Android Studio高級(jí)控件(自動(dòng)提示文本框)
一、高級(jí)控件與低級(jí)控件區(qū)別?
是否使用適配器
二、適配器種類和作用
種類
1、數(shù)組適配器 ArrayAdapter
new ArrayAdapter(this,R.layout.actv_style, names);
2、簡(jiǎn)單適配器 SimpleAdapter
3、自定義適配器
三、高級(jí)控件使用步驟
1、獲取數(shù)據(jù)
2、創(chuàng)建適配器
3、綁定適配器
例如:
1、自動(dòng)提示文本框
獨(dú)特屬性:android:completionThreshold=”2”—?設(shè)置輸入多少字符時(shí)自動(dòng)匹配
1、AutoCompleteTextView(單一提示)
2、MultiAutoCompleteTextView(多次提示)
設(shè)置多次提示時(shí),設(shè)置分隔符方法
mactv_main.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
activity_main.xml
<?xml version='1.0' encoding='utf-8'?><LinearLayout xmlns:android='http://schemas.android.com/apk/res/android' xmlns:app='http://schemas.android.com/apk/res-auto' xmlns:tools='http://schemas.android.com/tools' android:layout_width='match_parent' android:layout_height='match_parent' android:orientation='vertical' tools:context='.MainActivity'> <!--自動(dòng)提示文本框--> <!--(單一提示)--> <AutoCompleteTextView android: android:layout_width='match_parent' android:layout_height='60dp' android:hint='單一提示'/> <!--多次提示--> <MultiAutoCompleteTextView android: android:layout_width='match_parent' android:completionThreshold='1' android:layout_height='60dp' android:hint='多次提示'/></LinearLayout>
MainActivity.java
package com.example.t212_a6;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.util.Log;import android.view.View;import android.widget.AdapterView;import android.widget.ArrayAdapter;import android.widget.AutoCompleteTextView;import android.widget.MultiAutoCompleteTextView;import android.widget.SimpleAdapter;import android.widget.Spinner;import android.widget.Toast;import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map;public class MainActivity extends AppCompatActivity { private String[] data1; private ArrayAdapter<String> adapter1; private AutoCompleteTextView act_main_act1; private ArrayAdapter<String> adapter4; private MultiAutoCompleteTextView mact_main_mact1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); act_main_act1 = findViewById(R.id.act_main_act1); mact_main_mact1 = findViewById(R.id.mact_main_mact1);// 1、// 高級(jí)控件使用步驟// 3.1 獲取數(shù)據(jù) data1 = new String[] { '憤怒的小鳥', '湯姆貓', '落湯雞', '牛牛', '哈巴狗', '神龍', '烤鴨','小象', '美人魚', '九尾狐' };// 3.2 創(chuàng)建適配器 adapter1 = new ArrayAdapter<String>(this,R.layout.act_main_item1,data1);// 3.3 綁定適配器 act_main_act1.setAdapter(adapter1); //設(shè)置分隔符 adapter4 = new ArrayAdapter<String>(this,R.layout.act_main_item1,data1); mact_main_mact1.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer()); mact_main_mact1.setAdapter(adapter4); }}
在layout中寫一個(gè)項(xiàng)資源
<?xml version='1.0' encoding='utf-8'?><TextView xmlns:android='http://schemas.android.com/apk/res/android' android:layout_width='match_parent' android:textColor='@color/yellow' android:layout_height='match_parent'></TextView>
以上這篇android studio3.3.1代碼提示忽略大小寫的設(shè)置就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. CSS清除浮動(dòng)方法匯總2. XML入門的常見問題(三)3. HTML5實(shí)戰(zhàn)與剖析之觸摸事件(touchstart、touchmove和touchend)4. React優(yōu)雅的封裝SvgIcon組件示例5. CSS百分比padding制作圖片自適應(yīng)布局6. js開發(fā)中的頁(yè)面、屏幕、瀏覽器的位置原理(高度寬度)說明講解(附圖)7. XML 非法字符(轉(zhuǎn)義字符)8. 不要在HTML中濫用div9. 深入了解React中的合成事件10. TypeScript實(shí)現(xiàn)十大排序算法之歸并排序示例詳解
