Android 开发笔记___drawable
生活随笔
收集整理的這篇文章主要介紹了
Android 开发笔记___drawable
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
?
1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" 5 android:orientation="vertical"> 6 7 <Button 8 android:layout_width="wrap_content" 9 android:layout_height="wrap_content" 10 android:layout_gravity="center" 11 android:layout_margin="10dp" 12 android:text="默認(rèn)樣式的按鈕" 13 android:textColor="#000000" 14 android:textSize="17sp" /> 15 16 <Button 17 android:layout_width="wrap_content" 18 android:layout_height="wrap_content" 19 android:layout_gravity="center" 20 android:layout_margin="10dp" 21 android:paddingLeft="8dp" 22 android:paddingRight="8dp" 23 android:background="@drawable/btn_nine_selector" 24 android:text="定制樣式的按鈕" 25 android:textColor="#000000" 26 android:textSize="17sp" /> 27 28 </LinearLayout>selector
1 <?xml version="1.0" encoding="utf-8"?> 2 <selector xmlns:android="http://schemas.android.com/apk/res/android"> 3 <item android:state_pressed="true" android:drawable="@drawable/button_pressed" /> 4 <item android:drawable="@drawable/button_normal" /> 5 </selector>java
1 package com.example.alimjan.hello_world; 2 3 import android.app.Activity; 4 import android.content.Context; 5 import android.content.Intent; 6 import android.os.Bundle; 7 import android.support.annotation.Nullable; 8 9 /** 10 * Created by alimjan on 7/1/2017. 11 */ 12 13 public class class__2_4_1_1 extends Activity { 14 @Override 15 protected void onCreate(@Nullable Bundle savedInstanceState) { 16 super.onCreate(savedInstanceState); 17 setContentView(R.layout.code_2_4_1_1); 18 } 19 public static void startHome(Context mContext) { 20 Intent intent = new Intent(mContext, class__2_4_1_1.class); 21 mContext.startActivity(intent); 22 } 23 }| 狀態(tài)類型 | 說明 | 常用的控件 |
| state_pressed | 是否按下 | 按鈕button |
| state_checked | 是否勾選 | 單選框RadioButton、復(fù)選框chenckBox |
| state_focused | 是否獲取焦點 | 文本編輯框Edittext |
| state_selected | 是否選中 | 各控件均可 |
轉(zhuǎn)載于:https://www.cnblogs.com/alimjan/p/7102092.html
總結(jié)
以上是生活随笔為你收集整理的Android 开发笔记___drawable的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: grbl
- 下一篇: android sina oauth2.