Android的方法和属性(1)
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)的更多相关文章
- Android的方法和属性(2)
1.RadioButton(单选按钮) 嵌入到RsdioGroup中实现单选效果 android:checkedButton="radio的id值" int getCheckedR ...
- android中xml tools属性详解
第一部分 安卓开发中,在写布局代码的时候,ide可以看到布局的预览效果. 但是有些效果则必须在运行之后才能看见,比如这种情况:TextView在xml中没有设置任何字符,而是在activity中设置了 ...
- android中xmlns:tools属性详解
今天读到一篇总结的非常棒的文章,写的逻辑很清晰也很实用,很少见到如此棒的文章了.就原文转发过来,我把格式给整理了一下,分享给园子里的各位朋友!好久没写博客了,就为2015年的11月留份纪念吧.希望对你 ...
- 【Android】使用persist属性来调用脚本文件
Android系统中有许多属性,属性由两个部分组成:name & value,可以使用这些属性来记录系统设置或进程之间的信息交换.Android系统在启动过程时会按序从以下几个文件中加载系统属 ...
- Android开发之EditText属性详解
1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: 把该EditText设为:android:password="true" // 以”.”形式显示文本 ( ...
- android控件的属性
android控件的属性 本节描述android空间的位置,内容等相关属性及属性的含义 第一类:属性值为true或false android:layout_centerHrizontal 水平居中 ( ...
- 【转】 Android开发之EditText属性详解
原文网址:http://blog.csdn.net/qq435757399/article/details/7947862 1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: ...
- Android中的windowSoftInputMode属性详解
这篇文章主要介绍了Android中的windowSoftInputMode属性详解,本文对windowSoftInputMode的9个属性做了详细总结,需要的朋友可以参考下 在前面的一篇文章中 ...
- Android中Edittext的属性
//此为转载别人的,挺不错的 1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: 把该EditText设为:android:password="true" ...
随机推荐
- Oracle Shared Pool 原理
Oracle Shared Pool 原理 由于shared pool中最重要的是library cache,所以本文主要讲解Library cache的结构,library cache latch, ...
- Git学习笔记-完全版
注意本文参考廖雪博客: http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000 一:Git ...
- 常用的Issue解决方案(EF框架)
1.提交出错:ObjectStateManager 中已存在具有同一键的对象. ObjectStateManager 无法跟踪具有相同键的多个对象. 遇到此问题,首先要确定的是主键是否赋值,以及 ...
- springmvc 标签
https://www.baeldung.com/spring-mvc-form-tags 1. Overview In the first article of this series we ...
- JAVA 对象序列化——Serializable(转)
文章出自:http://www.cnblogs.com/chenfei0801/archive/2013/04/05/3001149.html Java的对象序列化是指将那些实现了Serializab ...
- [Cannot deserialize JSON array into type] NewtonSoft.Json解析数据出错原因
今天用NewtonSoft.JSon解析一个天气数据,数据格式如: {"status":1,"detail":"\u6570\u636e\u83b7\ ...
- Linux关于yum命令Error: Cannot retrieve repository metadata (repomd.xml) for repository:xxxxxx.
Linux关于yum命令Error: Cannot retrieve repository metadata (repomd.xml) for repository:xxxxxx. 问题: Linux ...
- jQuery上下切换带缩略图的焦点图
在线演示 本地下载
- Centos/ubuntu配置SVN服务
Centos安装svn yum -y install subversion ubuntu安装svn apt-get install subversion Centos配置svn root@hello: ...
- Spring_Bean 的作用域
beans-scope.xml <?xml version="1.0" encoding="UTF-8"?><beans xmlns=&quo ...