ここでは、ダイアログのスタイルを変更するために私が行うことを示します。最初に、グラデーションで塗りつぶされた背景と丸みを帯びたエッジを与える形状を定義します。
Filled_roundededges_box.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:startColor="#353535"
android:endColor="#222222"
android:angle="90" />
<stroke android:width="2dp" android:color="#808080"/>
<corners android:radius="5dp" />
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
</shape>
次に、この形状を使用してスタイルを作成します。
スタイル.xml:
<style name="AppCustomDialog" parent="android:style/Theme.Dialog">
<item name="android:windowBackground">@drawable/filled_roundededges_box</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowSoftInputMode">stateVisible</item>
</style>
最後に、このスタイルをボタンに適用します。
<ImageButton
android:id="@+id/addedit_btnPrev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:src="@drawable/left"
style="@style/App_ButtonStyle" />
または、次を使用して、スタイルをテーマとして who アプリに適用できます。
<application
android:icon="@drawable/ic_launcher_noteit1"
android:label="@string/app_name"
android:theme="@style/App_Theme"
android:name="NoteItApplication"
android:debuggable="true">