liguofeng29’s blog

個人勉強用ブログだっす。

AndroidのUI - Button

 

editText.xml
 
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="通常ボタン" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12pt"
android:shadowColor="#aa5"
android:shadowRadius="1"
android:shadowDx="5"
android:shadowDy="5"
android:text="影付きボタン" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/button_selector"
android:text="影付きボタン" />
</LinearLayout>
 

 

editText.xml
 
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 押したときの画像 -->
<item android:drawable="@drawable/red" android:state_pressed="true" />
<!-- 押してないときの画像 -->
<item android:drawable="@drawable/purple" android:state_pressed="false" />
</selector>