zoukankan      html  css  js  c++  java
  • 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="6"
        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="9"
        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>
    示例代码
  • 相关阅读:
    LeetCode之“数学”:Plus One
    LeetCode之“动态规划”:Dungeon Game
    LeetCode之“排序”:Largest Number
    LeetCode之“字符串”:ZigZag Conversion
    LeetCode之“数组”:Rotate Array
    HTML 5 简介、视频、Video + DOM、音频、拖放
    HTML 多媒体、Object 元素、音频、视频
    HTML5 Canvas、内联 SVG、Canvas vs. SVG
    HTML5 语义元素、迁移、样式指南和代码约定
    HTML5 简介、浏览器支持、新元素
  • 原文地址:https://www.cnblogs.com/yang82/p/6863489.html
Copyright © 2011-2022 走看看