android studio3.3.1代码提示忽略大小写的设置

所属分类: 软件编程 / Android 阅读数: 92
收藏 0 赞 0 分享

跟以往设置有区别,此处为取消红框勾选,设置即可

补充知识:Android Studio高级控件(自动提示文本框)

一、高级控件与低级控件区别?

是否使用适配器

二、适配器种类和作用

种类

1、数组适配器 ArrayAdapter

new ArrayAdapter(this,R.layout.actv_style, names);

2、简单适配器 SimpleAdapter

3、自定义适配器

三、高级控件使用步骤

1、获取数据

2、创建适配器

3、绑定适配器

例如:

1、自动提示文本框

独特属性:android:completionThreshold=”2”—–设置输入多少字符时自动匹配

1、AutoCompleteTextView(单一提示)

2、MultiAutoCompleteTextView(多次提示)

设置多次提示时,设置分隔符方法

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">

  <!--自动提示文本框-->
  <!--(单一提示)-->
  <AutoCompleteTextView
    android:id="@+id/act_main_act1"
    android:layout_width="match_parent"
    android:layout_height="60dp"
    android:hint="单一提示"/>

  <!--多次提示-->
  <MultiAutoCompleteTextView
    android:id="@+id/mact_main_mact1"
    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、
//    高级控件使用步骤
//    3.1 获取数据
    data1 = new String[] { "愤怒的小鸟", "汤姆猫", "落汤鸡", "牛牛", "哈巴狗", "神龙", "烤鸭",
        "小象", "美人鱼", "九尾狐" };
//    3.2 创建适配器
    adapter1 = new ArrayAdapter<String>(this,R.layout.act_main_item1,data1);
//    3.3 绑定适配器
    act_main_act1.setAdapter(adapter1);

    //设置分隔符

    adapter4 = new ArrayAdapter<String>(this,R.layout.act_main_item1,data1);
    mact_main_mact1.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    mact_main_mact1.setAdapter(adapter4);


  }

}

在layout中写一个项资源

<?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代码提示忽略大小写的设置就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

更多精彩内容其他人还在看

Android网络编程之获取网络上的Json数据实例

这篇文章主要介绍了Android网络编程之获取网络上的Json数据实例,本文用完整的代码实例讲解了在Android中读取网络中Json数据的方法,需要的朋友可以参考下
收藏 0 赞 0 分享

Android中的windowSoftInputMode属性详解

这篇文章主要介绍了Android中的windowSoftInputMode属性详解,本文对windowSoftInputMode的9个属性做了详细总结,需要的朋友可以参考下
收藏 0 赞 0 分享

Android网络编程之UDP通信模型实例

这篇文章主要介绍了Android网络编程之UDP通信模型实例,本文给出了服务端代码和客户端代码,需要的朋友可以参考下
收藏 0 赞 0 分享

Android中使用ListView实现漂亮的表格效果

这篇文章主要介绍了Android中使用ListView实现漂亮的表格效果,本文用详细的代码实例创建了一个股票行情表格,需要的朋友可以参考下
收藏 0 赞 0 分享

Android中刷新界面的二种方法

这篇文章主要介绍了Android中刷新界面的二种方法,本文使用Handler、postInvalidate两种方法实现界面刷新,需要的朋友可以参考下
收藏 0 赞 0 分享

Android SDK三种更新失败及其解决方法

这篇文章主要介绍了Android SDK三种更新失败及其解决方法,需要的朋友可以参考下
收藏 0 赞 0 分享

Android学习笔记——Menu介绍(一)

Android3.0(API level 11)开始,Android设备不再需要专门的菜单键。随着这种变化,Android app应该取消对传统6项菜单的依赖。取而代之的是提供anction bar来提供基本的用户功能
收藏 0 赞 0 分享

Android学习笔记——Menu介绍(二)

这次将继续上一篇文章没有讲完的Menu的学习,上下文菜单(Context menu)和弹出菜单(Popup menu)
收藏 0 赞 0 分享

Android学习笔记——Menu介绍(三)

今天继续昨天没有讲完的Menu的学习,主要是Popup Menu的学习,需要的朋友可以参考下
收藏 0 赞 0 分享

Android显示网络图片实例

这篇文章主要介绍了Android显示网络图片的方法,以实例形式展示了Android程序显示网络图片的方法,非常具有实用价值,需要的朋友可以参考下
收藏 0 赞 0 分享
查看更多