1、TextView:(文本框):不能编辑
    android:textColor="@color/tv_show_color" 字体颜色
    android:textSize="@dimen/tv_show_size" 字体大小
    android:typeface="monospace" 字体类型
    android:textScaleX="10" 字体间的间隔
    android:textStyle="bold|italic" 字体样式
    常用的事件OnClickListener

2、EditText(编辑框)

3、Button、ImageButton(区别?Button可以放背景和文字,ImageButton只能放背景图片)
 <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:state_pressed="true" android:drawable="@drawable/pause"/>
    <item android:state_pressed="false" android:drawable="@drawable/play"/>
    <item android:state_focused="true" android:color="#ff0000"/>
</selector>
   背景选择器作用:根据事件源不同的状态去选择满足条件的图片或颜色

4、RadioGroup、RadioButton
  用到的事件:实现RadioGroup.OnCheckedChangeListener()接口 注意区别复选框的事件

5、CheckBox
   实现的CompoundButton.OnCheckedChangeListener接口

6、ImageView(图片框)
       android:scaleType="fitCenter" 图片显示比例类型
       android:adjustViewBounds="true"  图片根据imageView的大小自动调整
       android:src="@drawable/bomb5"  存放的图片

7、资源文件中 style标签的使用
作用:把重复的属性抽取出来被称为一个样式,样式可以继承重写,可以减少代码的冗余
调用:  style="@style/ed_style"
注意:继承方式有两种,如下:
    <?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="ed_style">
        <item name="android:textColor">@color/ed_color</item>
        <item name="android:textSize">@dimen/ed_dimen</item>
        <item name="android:inputType">textPassword</item>
    </style>
   
    <style name="ed2_style" parent="@style/ed_style">
        <item name="android:textColor">@color/ed_color2</item>
       
    </style>
   
     <style name="ed_style.ed3_style" >
        <item name="android:textColor">@color/ed_color2</item>
       
    </style>

</resources>

8、修改控件的外观可以在drawable新建 shape标签样式
 <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"
   
    >
  <!-- 四个角度 -->
    <corners
        android:bottomLeftRadius="15dp"
        android:bottomRightRadius="15dp"
        android:topLeftRadius="15dp"
        android:topRightRadius="15dp" />
    <!-- 填充 -->
    <solid android:color="#ffffff"/>
   
    <!-- 尺寸 -->
    <size android:width="300dp" android:height="50dp"/>
    <!-- 内边距 -->
    <padding android:left="30dp" android:right="30dp"/>
    <!-- 渐变色 -->
    <gradient android:startColor="#ff0000" android:centerColor="#0000ff" android:endColor="#00ff00" android:angle="45"/>
    <!-- 外边框 -->
    <stroke  android:width="3dp" android:color="#ff0000" android:dashWidth="3dp" android:dashGap="3dp"/>

</shape>

9、onKeyDown事件(键盘事件)
  只要重写Activity的onKeyDown事件

10、onTouchEvent事件(触摸事件)
 只要重写Activity的onTouchEvent事件

常用的基本控件 android常用控件的更多相关文章

  1. Android 常用 adb 命令

    查看原文:http://blog.csdn.net/u010818425/article/details/52266593 (一)基础操作 安装app adb install -r xxx.apk / ...

  2. 【风马一族_Android】第4章Android常用基本控件

    第4章Android常用基本控件 控件是Android用户界面中的一个个组成元素,在介绍它们之前,读者必须了解所有控件的父类View(视图),它好比一个盛放控件的容器. 4.1View类概述 对于一个 ...

  3. [置顶] Android常用适配器控件

    Android常用适配器控件 列表控件用于显示数据集合,Android不是使用一种类型的控件管理显示和数据,而是将这两项功能分布用列表控件和适配器来实现.列表控件扩展了android.widget.A ...

  4. Android常用酷炫控件(开源项目)github地址汇总

    转载一个很牛逼的控件收集帖... 第一部分 个性化控件(View) 主要介绍那些不错个性化的 View,包括 ListView.ActionBar.Menu.ViewPager.Gallery.Gri ...

  5. Android 常用炫酷控件(开源项目)git地址汇总

    第一部分 个性化控件(View) 主要介绍那些不错个性化的 View,包括 ListView.ActionBar.Menu.ViewPager.Gallery.GridView.ImageView.P ...

  6. Android 开源控件与常用开发框架开发工具类

    Android的加载动画AVLoadingIndicatorView 项目地址: https://github.com/81813780/AVLoadingIndicatorView 首先,在 bui ...

  7. Android常用布局和控件

    一.Android常用布局属性 1. LinearLayout的特有属性 android:orientation:设置布局排列方式   android:layout_weight:设置所占布局的权重  ...

  8. Android常用控件

     Android 中使用各种控件(View) DatePicker - 日期选择控件 TimePicker - 时间选择控件 ToggleButton - 双状态按钮控件 EditText - 可编辑 ...

  9. Android SDK提供的常用控件Widget “常用控件”“Android原生”

    Android提供一个标准的视图工具箱来帮助创建简单的UI界面.通过使用这些控件(必要时,可以对这些控件进行修改). 创建一个简单的.xml文件,从预览窗口可以看到Android SDK提供的原生控件 ...

随机推荐

  1. hdu 1847(SG函数,巴什博弈)

    Good Luck in CET-4 Everybody! Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ...

  2. 洛谷 P2639 [USACO09OCT]Bessie的体重问题Bessie's We… 题解

    题目传送门 这也是个01背包,只是装的很... #include<bits/stdc++.h> #define MAXN 45010 using namespace std; int f[ ...

  3. MVC – 3.EF(Entity Framework)

    1.实体框架(EF)简介 与ADO.NET的关系 全称是ADO.NET Entity Framework,是微软开发的基于ADO.NET的ORM(Object/Relational Mapping)框 ...

  4. Codeigniter处理用户登录验证后URL跳转

    涉及到My_Controller.php以及登录验证模块User.php,代码如下: My_Controller.php class MY_Controller extends CI_Controll ...

  5. AC日记——825G - Tree Queries

    825G - Tree Queries 思路: 神题,路径拆成半链: 代码: #include <cstdio> #include <cstring> #include < ...

  6. 湖南大学ACM程序设计新生杯大赛(同步赛)C - Do you like Banana ?

    题目描述 Two endpoints of two line segments on a plane are given to determine whether the two segments a ...

  7. 洛谷P1486 [NOI2004]郁闷的出纳员 [STL,平衡树]

    题目传送门 郁闷的出纳员 题目描述 OIER公司是一家大型专业化软件公司,有着数以万计的员工.作为一名出纳员,我的任务之一便是统计每位员工的工资.这本来是一份不错的工作,但是令人郁闷的是,我们的老板反 ...

  8. AM335x内核模块驱动之LED

    在Ubuntu的任意可操作的文件才建立text目录 在text中建立zyr-hello.c: #include<linux/kernel.h> #include<linux/modu ...

  9. Cpp下的深拷贝与浅拷贝探究

    下面,通过代码来说说C++中的深浅拷贝 #define _CRT_SECURE_NO_WARNINGS #include<iostream> using namespace std; cl ...

  10. PowerBuilder连接数据库

    什么是PowerBuilder(后面简称PB)? 这是个奇怪的问题,说实话,在这次毕业设计之前,我也不知道什么是PowerBulider(当然,不排除我见识短浅).百度百科是这样解释的:"P ...