囲み線を描画する
drawableフォルダにxmlファイルで記述します。
- group_back.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color ="#FFFFFF"/> <stroke android:width ="1dp" android:color ="#C2C2C2"/> <padding android:left ="10dp" android:top ="10dp" android:right ="10dp" android:bottom ="10dp"/> <corners android:radius ="6dp"/> </shape>
レイアウトのバックグラウンドにリソースを設定すればOK。
- レイアウトの例
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="10dp" android:orientation="vertical" tools:context=".MainActivity" > <TextView android:id="@+id/TextView01" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="画面1" android:textSize="32px" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:background="@drawable/group_back"> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="音量" android:textAppearance="?android:attr/textAppearanceLarge" /> <SeekBar android:id="@+id/seekBar1" android:layout_width="match_parent" android:layout_height="wrap_content" /> </LinearLayout> </LinearLayout>