背景のButton
ドローアブルandroid:layout_width="wrap_content"
と android:layout_height="wrap_content"
. ボタンにテキストはありません。ただし、その表示サイズは、幅と高さを.drawableの幅と高さに設定しない限り、drawableのサイズが少し変更されてぼやけて見えますpx
。どうすればwrap_content
仕事をすることができますか?または、ドローアブルのサイズが変更されたときに追加の編集を行う必要がないように、ボタンのサイズをハードコーディングする必要のない他の方法はありますか?
ここに私のXMLがあります:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="3dp"
android:paddingTop="3dp" >
<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/btn" />
</RelativeLayout>
</LinearLayout>
</ScrollView>