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" ...
随机推荐
- 关于shared pool的深入探讨(一) 【转载】
关于shared pool的深入探讨(一) 作者:eygle |English [转载时请标明出处和作者信息]|[恩墨学院 OCM培训传DBA成功之道]链接:http://www.eygle.co ...
- IOS中快速集成短信SDK验证开发(SMSSDK),IOS开发中如何设置手机验证码
[转载请注明出处] sdk是别人的,我只是下载来集成一下. smssdk下载网站:http://www.mob.com/(也有其他很多网站有类似SDK,譬如https://www.juhe.cn/等等 ...
- mysql双向主从同步
双向主从同步 双方互相主从同步配置 然后再my.cnf中加上如下配置 [mysqld]master1:auto_increment_increment = 2 //自增ID的间隔,如1 3 5间隔为2 ...
- IE调试页面总结
随着IE版本的升级,IE变的越来越强大,随之带来的问题也是越来越明显,如:如何调试在低版本的浏览器中 的情况 IE9的方法: 出于未知需求,用户在安装了较高版本IE浏览器(IE9)之后,又需要使用低版 ...
- 10 Spring框架 AOP (三) Spring对AspectJ的整合
上两节我们讲了Spring对AOP的实现,但是在我们的开发中我们不太使用Spring自身的对AOP的实现,而是使用AspectJ,AspectJ是一个面向切面的框架,它扩展了Java语言.Aspect ...
- PAT 天梯赛 L1-014. 简单题 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-014 AC代码 #include <iostream> #include <cstdio&g ...
- HDU - 6437 Problem L.Videos 2018 Multi-University Training Contest 10 (最小费用最大流)
题意:M个影片,其属性有开始时间S,结束时间T,类型op和权值val.有K个人,每个人可以看若干个时间不相交的影片,其获得的收益是这个影片的权值val,但如果观看的影片相邻为相同的属性,那么收益要减少 ...
- POJ 1659 Frogs' Neighborhood (Havel定理构造图)
题意:根据图的度数列构造图 分析:该题可根据Havel定理来构造图.Havel定理对可图化的判定: 把序列排成不增序,即d1>=d2>=……>=dn,则d可简单图化当且仅当d’={d ...
- 文件操作工具类: 文件/目录的创建、删除、移动、复制、zip压缩与解压.
FileOperationUtils.java package com.xnl.utils; import java.io.BufferedInputStream; import java.io.Bu ...
- Django QuerySet API
https://docs.djangoproject.com/en/2.1/ref/models/querysets/