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. linux网络基础设置 以及 软件安装

    ifconfig #查看所有已激活的网卡信息 临时配置 #yum install net-tools -y 默认ifconfig是没有安装的,可能需要安装 ifconfig eth0 #查看单独一块网 ...

  2. 错误:为 Web 项目“XXX”配置的 URL“http://localhost/”的网站同时存在于本地 IIS Web 服务器和 IIS Express Web 服务器上。您需要使用 IIS 管理器在 IIS 中更改此网站的绑定。

    解决方法: 用记事本打开MVC网站的项目文件(*.csproj),滚动条拉到最下,找到这两个节点: <UseIIS>True</UseIIS> <AutoAssignPo ...

  3. Linux系统配置VI或VIM的技巧

    Linux系统配置VI或VIM的技巧作者:IT专家网论坛出处:IT专家网论坛2008-10-28 11:08配置VI和VIM的颜色显示,使它能够高亮度显示一些特别的单词,这对编写程序很有用⋯⋯ 1.V ...

  4. selet2使用大全

    selet2是一款input+selet结合的组件,是最好的搜索下拉框,没有之一.原因是别的没有,只有它这么一家,你没得选择.正如有人说它‘Select2不是特别好用,但又找不到比它更好的下拉框插件. ...

  5. javascript Date对象 之 时间转字符串

    javascript Date对象 --> 时间转字符串: 测试代码: <!DOCTYPE html> <html lang="en"> <he ...

  6. [ufldl]Supervised Neural Networks

    要实现的部分为:forward prop, softmax函数的cost function,每一层的gradient,以及penalty cost和gradient. forwad prop forw ...

  7. resin服务一直不停重启

    resin服务不断重启. 原因为resin配置文件使用域名.需要到服务上绑定一下域名.

  8. [CF19E]Fairy

    给定一张n个点m条边的无向图,求删除哪一条边后,能够确保构成一个二分图,输出所有可能 解法:我们知道二分图的性质是没有奇环,这道题我们也应该从这个方面入手来考虑. 如果没有奇环的话我们当然想怎么删就怎 ...

  9. AtCoder Regular Contest 098

    AtCoder Regular Contest 098 C - Attention 题意 给定一个只包含"E","W"字符串,可以花一的花费使他们互相转换.选定 ...

  10. android studio 慢的问题

    转自:http://www.jianshu.com/p/e1c0b46e317c 在使用Android studio的时候常常遇到这样的问题,从github或是其他地方导入项目,Android stu ...