Android中的基本控件(上)--按钮控件Button

简介: <p>Button类的继承结构:</p> <p><strong><span style="color:#000099">java.lang.Object<br><span style="white-space:pre"></span>  ↳<span style="white-space:pre"> </span>android.view.View</span></strong></p>

Button类的继承结构:

java.lang.Object
  ↳ android.view.View

  android.widget.TextView

  android.widget.Button 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
	android:orientation="vertical"
	android:layout_width="fill_parent"
	android:layout_height="fill_parent" >

    <Button
        android:id = "@+id/mybut1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#FF0000"
        android:textSize="12px"
        android:text="按钮组件" />  

</RelativeLayout>

所有组件垂直摆放
布局管理器宽度为屏幕宽度
布局管理器高度为屏幕高度
定义组件按钮的id,为Activity程序使用
宽度为文字的宽度
高度为文字的高度
文字的颜色RGB码
设置文字大小
设置文本



目录
相关文章
|
3天前
|
XML Android开发 数据格式
Android下自定义Button样式
Android下自定义Button样式
10 3
|
3天前
|
XML Java Android开发
Android控件动态使用 (转)
Android控件动态使用 (转)
|
6天前
|
调度 Android开发
Android9底部导航栏出现空白按钮问题分析
Android9底部导航栏出现空白按钮问题分析
12 0
|
1月前
|
XML Java Android开发
Android控件之基础控件——进度条类的view——TextView、Checkbox复选控件、RadioButton单选控件、ToggleButton开关、SeekBar拖动条、menu、弹窗
Android控件之基础控件——进度条类的view——TextView、Checkbox复选控件、RadioButton单选控件、ToggleButton开关、SeekBar拖动条、menu、弹窗
|
1月前
|
XML 编解码 Java
Android控件之高级控件——ListView、cardView、屏幕适配
Android控件之高级控件——ListView、cardView、屏幕适配
|
1月前
|
Android开发
Android控件——Checkbox复选框、RadioButton单选、ToggleButton开关、SeekBar拖动条
Android控件——Checkbox复选框、RadioButton单选、ToggleButton开关、SeekBar拖动条
|
1月前
|
XML Java Android开发
Android之UI基础控件
Android之UI基础控件
|
9月前
|
XML Android开发 数据格式
Android中利用shape属性自定义设置Button按钮
Android中利用shape属性自定义设置Button按钮
148 0
|
XML Android开发 数据格式
Android--代码实现自定义Button
版权声明:本文为博主原创文章,转载请标明出处。 https://blog.csdn.net/chaoyu168/article/details/80350654 使用StateButton.
1176 0