1.AutoCompleteTextView

ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, COUNTRIES);
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.edit);
textView.setAdapter(adapter);
//this word for auto-completion by words
textView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
static final String[] COUNTRIES = new String[] {
"Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra",
"Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina",
"Armenia", "Aruba", "Australia", "Austria", "Azerbaijan",
"Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium",
"Belize", "Benin", "Bermuda", "Bhutan", "Bolivia",
"Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory",
"British Virgin Islands", "Brunei", "Bulgaria", "Burkina Faso", "Burundi",
"Cote d'Ivoire", "Cambodia", "Cameroon", "Canada", "Cape Verde",
"Cayman Islands", "Central African Republic", "Chad", "Chile", "China",
"Christmas Island", "Cocos (Keeling) Islands"}

2.LinearLayout 的android:baselineAlignedChildIndex="2"属性作用。一张图片说明其作用

3.GridLayout 简化了对复杂布局的处理,包括性能提高不是一倍两倍。但是不支持SDK版本低于14的手机。不过有兼容包,不过我还没找到。

请看布局代码:

<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--> <GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:alignmentMode="alignBounds"
android:columnCount="4"
android:columnOrderPreserved="false"
android:useDefaultMargins="false" > <EditText
android:layout_columnSpan="3"
android:layout_gravity="fill" /> <Button android:text="/"/> <Button android:text="1" /> <Button android:text="2" /> <Button android:text="3" /> <Button android:text="*" /> <Button android:text="4" /> <Button android:text="5" /> <Button android:text="6" /> <Button android:text="-" /> <Button android:text="7" /> <Button android:text="8" /> <Button android:text="9" /> <Button
android:layout_gravity="fill_vertical"
android:layout_rowSpan="3"
android:text="+" /> <Button
android:layout_columnSpan="2"
android:layout_gravity="fill"
android:text="0" /> <Button android:text="00" /> <Button
android:layout_columnSpan="3"
android:layout_gravity="fill_horizontal"
android:text="=" /> </GridLayout>

效果图如下:

android之‘com.example.android.apis.view’的代码段的更多相关文章

  1. 一起来学习android自定义控件3——边缘凹凸的View

    前言 最近做项目的时候遇到一个卡劵的效果,由于自己觉得用图片来做的话可以会出现适配效果不好,再加上自己自定义view方面的知识比较薄弱,所以想试试用自定义View来实现.先看设计图效果 实现分析 上面 ...

  2. Android Studio开发基础之自定义View组件

    一般情况下,不直接使用View和ViewGroup类,而是使用使用其子类.例如要显示一张图片可以用View类的子类ImageView,开发自定义View组件可分为两个主要步骤: 一.创建一个继承自an ...

  3. Android Animation学习(六) View Animation介绍

    Android Animation学习(六) View Animation介绍 View Animation View animation系统可以用来执行View上的Tween animation和F ...

  4. Android 采用Layout Inflater创建一个View对象

    接着上文<Android ListViewview入门>,本文使用android的Inflater来实现 在layouyt文件夹中新建一个list_item.xml的文件,添加如下代码: ...

  5. android 最简单的自定义圆点view

    首先创建一个选择器,用来判断圆点状态,可以根本自己的需求改 <selector xmlns:android="http://schemas.android.com/apk/res/an ...

  6. Android UI性能优化实战, 识别View中的性能问题

    出自:[张鸿洋的博客]来源:http://blog.csdn.net/lmj623565791/article/details/45556391 1.概述 2015年初google发布了Android ...

  7. Android群英传笔记系列三 view的自定义:实现一个模拟下载

    1.实现效果:动态显示进度(分别显示了整个的动态改变的过程,然后完成后,弹出一个对话框)       2.实现过程:可以分为绘制一个圆,圆弧和文本三部分,然后在MainAcitivity中通过线程模拟 ...

  8. android 应用架构随笔四(View、ViewGroup)

    View表示了用户界面的基本构建模块. 一个View占用了屏幕上的一个矩形区域并且负责界面绘制和事件处理.手机屏幕上所有看得见摸得着的都是View. Activity是四大组件中唯一一个用来和用户进行 ...

  9. Android进阶笔记08:Android 中Activity、Window和View之间的关系

    1. Android 中Activity.Window和View之间的关系(比喻): Activity像一个工匠(控制单元),Window像窗户(承载模型),View像窗花(显示视图) LayoutI ...

随机推荐

  1. Selenium2学习-021-WebUI自动化实战实例-019-设置浏览器窗口位置大小

    前文简略讲述了如何获取浏览器窗口的位置和大小,此文讲述如何通过 webdriver 设置浏览器窗口的位置和大小. 直接上码了...... /** * Set browser size for expe ...

  2. 【Android Studio快捷键】之导入相应包声明(import packages)

    可能import 单个声明的快捷键大家都很容易找到,Alt+Enter.但是如果我要一次性import文件中所有的声明,这个快捷键是什么呢,找啊找的,就是没找到,以前在Eclipse是Ctrl+1,但 ...

  3. synchronized锁自旋

    http://www.jianshu.com/p/5dbb07c8d5d5 原理 通常说的synchronized在方法或块上加锁,这里的锁就是对象锁(当然也可以在类上面),或者叫重量锁,在JVM中又 ...

  4. iOS:app直播---原理篇

    [如何快速的开发一个完整的iOS直播app](原理篇) 转载自简书@袁峥Seemygo:http://www.jianshu.com/p/7b2f1df74420   一.个人见解(直播难与易) 直播 ...

  5. 多大开始玩EV3

    机器人EV3还是初中生才能玩的溜 耐撕爸爸推荐年龄:初中及以上 推荐理由:无需使用计算机就可进行编程,培养孩子的编程.机械.电子.物理等综合能力. 在欧美等国家,乐高机器人融入教学已成为一种普遍现象, ...

  6. php中对2个数组相加的函数

    <?php function array_add($a,$b){ //根据键名获取两个数组的交集 $arr=array_intersect_key($a, $b); //遍历第二个数组,如果键名 ...

  7. C#高级编程 反射 代码示例

    反射 反射(Reflection)是.NET中的重要机制,通过反射,可以在运行时获得.NET中每一个类型(包括类.结构.委托.接口和枚举等)的成员,包括方法.属性.事件,以及构造函数等. 还可以获得每 ...

  8. MFC和GDI+一起使用

    VS2010,新建MFC项目,在头文件stdafx.h中添加: #include <gdiplus.h> using namespace Gdiplus; #pragma comment ...

  9. MYBATIS报ORA-01745: 无效的主机/绑定变量名 异常

    异常:Cause: java.sql.SQLSyntaxErrorException: ORA-01745: 无效的主机/绑定变量名 原因,sql语句中,两个填充变量间没有写逗号.

  10. Oracle 10G如何从recovery catalog中Unregister目标数据库

    从10g开始,RMAN简化了unregister目标数据库的步骤 方法1: $rman target system/oracle@test catalog rman/rman@catadb rman& ...