閱讀663 返回首頁    go 技術社區[雲棲]


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

Button類的繼承結構:

java.lang.Object
  ↳ android.view.View

  android.widget.TextView

  android.widget.Button 

<RelativeLayout xmlns:andro
    xmlns:tools="https://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碼
設置文字大小
設置文本



最後更新:2017-04-03 12:56:05

  上一篇:go 使用Cocos2d-x製作三消類遊戲Sushi Crush(第一部分)
  下一篇:go RDS 循序漸進 – 閃斷篇