ANDROIDノート:Buttonのシンプルな使い方

8350 ワード

 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:background="@drawable/bnt_selector"

11         android:text="  "

12         android:textColor="#ffffff" />

13     <!--       -->

14 

15     <Button

16         android:layout_width="wrap_content"

17         android:layout_height="wrap_content"

18         android:background="@drawable/bnt_selector"

19         android:enabled="false"

20         android:text="     "

21         android:textColor="#ffffff" />

22     <!--        -->

23 

24     <Button

25         android:layout_width="wrap_content"

26         android:layout_height="wrap_content"

27         android:background="@drawable/bnt_selector"

28         android:drawableTop="@drawable/ic_launcher"

29         android:text="  "

30         android:textColor="#ffffff"

31         android:textSize="20sp" />

32 

33 </LinearLayout>
 1 <?xml version="1.0" encoding="utf-8"?>

 2 <selector xmlns:android="http://schemas.android.com/apk/res/android">

 3 

 4     <!--       -->

 5     <!--      -->

 6     <item android:drawable="@drawable/btn_small_null" android:state_enabled="false"></item>

 7     <!--      -->

 8     <item android:drawable="@drawable/btn_small_hover" android:state_pressed="true"></item>

 9     <!--      (    ) -->

10     <item android:drawable="@drawable/btn_small" android:state_pressed="false"></item>

11 

12 </selector>

ANDROID笔记:Button的简单使用