1.Activity常用的方法
  View findViewById(int id) //根据组件的ID取得组件对象
  setContentView(int layoutResID) //设置布局文件,设置显示组件

2.TextView
  android:maxLength="6" //允许最大字符数
  android:textColor="#FF0000" //文字的颜色
  android:textSize="50px" //文字的大小
  android:textStyle="bold" //文字样式
  android:password="true" //是否以密文方式显示
  android:layout_margin="50px" //外边距
  android:background="@drawable/p" //背景
  android="@+id/id值" //设置id的值

  getText().toString(); //获得控件的文本内容
  setText(); //设置控件的文本内容
  注意:<!-- -->:注释

3.Button

4.EditText
  android:enabled="false" //设置是否可用,false不能用

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<!--
<TextView
android="@+id/tv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Second123"
android:maxLength=""
android:textColor="#FF0000"
android:textSize="50px"
android:textStyle="bold"
android:password="true"
android:layout_margin="50px"
android:background="@drawable/p"
/>
--> <!-- prefix:前缀 -->
<TextView
android="@+id/tv2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Second123"
android:maxLength=""
android:textColor="#00FF00"
android:textSize="50px"
android:textStyle="bold"
android:password="true"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="按钮"
android:textColor="#FF0000"
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="我是好人"
android:enabled="false"
/>
</LinearLayout>

示例代码

Android的方法和属性(1)的更多相关文章

  1. Android的方法和属性(2)

    1.RadioButton(单选按钮) 嵌入到RsdioGroup中实现单选效果 android:checkedButton="radio的id值" int getCheckedR ...

  2. android中xml tools属性详解

    第一部分 安卓开发中,在写布局代码的时候,ide可以看到布局的预览效果. 但是有些效果则必须在运行之后才能看见,比如这种情况:TextView在xml中没有设置任何字符,而是在activity中设置了 ...

  3. android中xmlns:tools属性详解

    今天读到一篇总结的非常棒的文章,写的逻辑很清晰也很实用,很少见到如此棒的文章了.就原文转发过来,我把格式给整理了一下,分享给园子里的各位朋友!好久没写博客了,就为2015年的11月留份纪念吧.希望对你 ...

  4. 【Android】使用persist属性来调用脚本文件

    Android系统中有许多属性,属性由两个部分组成:name & value,可以使用这些属性来记录系统设置或进程之间的信息交换.Android系统在启动过程时会按序从以下几个文件中加载系统属 ...

  5. Android开发之EditText属性详解

    1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: 把该EditText设为:android:password="true" // 以”.”形式显示文本 ( ...

  6. android控件的属性

    android控件的属性 本节描述android空间的位置,内容等相关属性及属性的含义 第一类:属性值为true或false android:layout_centerHrizontal 水平居中 ( ...

  7. 【转】 Android开发之EditText属性详解

    原文网址:http://blog.csdn.net/qq435757399/article/details/7947862 1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: ...

  8. Android中的windowSoftInputMode属性详解

    这篇文章主要介绍了Android中的windowSoftInputMode属性详解,本文对windowSoftInputMode的9个属性做了详细总结,需要的朋友可以参考下     在前面的一篇文章中 ...

  9. Android中Edittext的属性

    //此为转载别人的,挺不错的 1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: 把该EditText设为:android:password="true"  ...

随机推荐

  1. shell脚本调用传参【转载】

    转自:https://www.cnblogs.com/cisum/p/8010658.html 1.直接使用$0,$1,$2,$3 $0是脚本的名字,就是按顺序来 #!/bin/bash # auth ...

  2. python 的两个模块xlwt,xlrd,写入和读取Excel数据

    http://www.cnblogs.com/fireme/p/3887284.html 这上面写的很全,不过我只需要简单的读和写的操作就ok了,下面是我写的读和写入Excel操作 读取Excel数据 ...

  3. Uber中国在地方城市的人员架构是怎样的?

    http://www.thepaper.cn/newsDetail_forward_1390516 澎湃新闻:Uber中国在地方城市的人员架构是怎样的?   柳甄:一般是3人组成的小团队作战.一名城市 ...

  4. AngularJS post传值后台获取不到

    AngularJS post传值后台获取不到 一般的思路: 解决办法: 1.设置一下default head  2.参数转换一下data:$.param({orderNo: orderNo,sessi ...

  5. vue项目配置less预编译语言

    当所有东西都 准备好之后 : 第一步: 安装less依赖,npm install less less-loader --save 第二步:找到webpack配置文件webpack.base.conf. ...

  6. J2EE--Struts2基础开发笔记

    内容中包含 base64string 图片造成字符过多,拒绝显示

  7. grable编译spring源码并导入eclipse

    1.下载安装gradle, spring 源码构建加入了gradle支持. gradle下载: http://www.gradle.org/downloads ,下载后设置环境变量: GRADLE_H ...

  8. Shiro缓存使用Redis、Ehcache、自带的MpCache实现的三种方式实例

    第一种:使用Redis做缓存,将数据存储到redis数据库中 第一步:在项目里面引入redis,配置文件如下: 配置文件:spring_shiro_redis.xml <?xml version ...

  9. 网易编程题——Fibonacci数列

    题目描述 Fibonacci数列是这样定义的: F[0] = 0 F[1] = 1 for each i ≥ 2: F[i] = F[i-1] + F[i-2] 因此,Fibonacci数列就形如:0 ...

  10. 解决com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes异常

    错误截图: 解决方法: 用root进入mysql终端,执行以下命令: alter database hive character set latin1;