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" ...
随机推荐
- 10046 trace详解(2)--tkprof
10046或10053生成的文件格式比较乱,直接查看有一定的困难,ORACLE自带的一个格式化命令工具tkprof可以将生成的.trc文件进行格式化,具体用说如下: 一.直接输入tkprof不带任 ...
- [笔记]Go语言实现同一结构体适配多种消息源
问题: 提供天气信息的网站有很多,每家的数据及格式都不同,为了适配各种不同的天气接口,写了如下程序. 代码如下: package main import ( "encoding/json&q ...
- python3 requests模块
一.Requests用法: 1.发送请求: 1).请求类型:req_obj = requests.get("https://www.baidu.com")requests支持多种请 ...
- JSP SERVLET 基础知识
jsp(java server page)和servlet是JAVA EE规范的两个基本成员,是JAVA WEB开发的重点也是基础知识.JSP本质上也需要编译成SERVLET运行. JSP比较简单,可 ...
- Hadoop2.7.x中所有的DataNode都启动不了解决办法
参考:Hadoop集群所有的DataNode都启动不了解决办法说明现象:我自己出现这个问题的原因是:自己在namenode格式化之后创建了一些文件,然后重新执行了namenode格式化导致的. 现象就 ...
- 剑指offer编程题66道题 1-25
1.二维数组中的查找 题目描述 在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序.请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数. ...
- Python3:input()输入函数的用法
Python3:input()输入函数的用法 一.简介 input这个函数,第一个参数是提示语,它默认是空的.在我们使用input的时候,会从标准输入中读取一个string,即字符串(请注意,这里很重 ...
- centos 6+安装山逗斯骚尅特
系统支持:CentOS 6+,Debian 7+,Ubuntu 12+ 内存要求:≥128M 关于本脚本 一键安装 Shadowsocks-Python, ShadowsocksR, Shadowso ...
- GitLab 安装与入门
GitLab介绍: GitLab是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目. GitLab拥有与Github ...
- IIS Manager could not load type for module provider 'SharedConfig' that is declared in administration.config
https://support.microsoft.com/en-ie/help/3151973/iis-shared-configuration-feature-requires-all-serve ...