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

所属分类: 软件编程 / Android 阅读数: 42
收藏 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实现信号强度监听的方法

这篇文章主要介绍了Android实现信号强度监听的方法,是Android手机中很常见的一个实用功能,需要的朋友可以参考下
收藏 0 赞 0 分享

Android实现Activity界面切换添加动画特效的方法

这篇文章主要介绍了Android实现Activity界面切换添加动画特效的方法,非常实用的技巧,需要的朋友可以参考下
收藏 0 赞 0 分享

Android中Dialog去黑边的方法

这篇文章主要介绍了Android中Dialog去黑边的方法,需要的朋友可以参考下
收藏 0 赞 0 分享

Qt for Android开发实例教程

这篇文章主要介绍了Qt for Android开发的方法,具有一定的参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

Android开发之时间日期操作实例

这篇文章主要介绍了Android开发之时间日期操作,是Android程序开发中常见的一个功能,需要的朋友可以参考下
收藏 0 赞 0 分享

Android开发之时间日期组件用法实例

这篇文章主要介绍了Android开发之时间日期组件用法,主要介绍了TimePicker和DatePicker组件,对于Android程序开发有不错的借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

Android开发之获取网络链接状态

这篇文章主要介绍了Android获取网络链接状态的方法,主要是通过ConnectivityManager类来完成的,需要的朋友可以参考下
收藏 0 赞 0 分享

Android开发之广播机制浅析

这篇文章主要介绍了Android开发之广播机制浅析,主要包括了发布、接收及配置广播的实例,需要的朋友可以参考下
收藏 0 赞 0 分享

Android开发之登录验证实例教程

这篇文章主要介绍了Android开发之登录验证实现方法,包括发送数据、服务器端验证、配置文件等,需要的朋友可以参考下
收藏 0 赞 0 分享

Android开发之注册登录方法示例

这篇文章主要介绍了Android开发的注册登录方法,是针对Android程序设计中版本兼容性的进一步完善,需要的朋友可以参考下
收藏 0 赞 0 分享
查看更多