1

私はAndroid開発の初心者です。カスタマイズされたユーザーインターフェイスを設計するのは非常に困難です

アンドロイド。デフォルトの形状がラクタングルの画像ボタンがあるので、次のようにする必要があります

丸みを帯びた

助けてください。

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:background="#82B210"

android:paddingBottom="@dimen/activity_vertical_margin"

android:paddingLeft="@dimen/activity_horizontal_margin"

android:paddingRight="@dimen/activity_horizontal_margin"

android:paddingTop="@dimen/activity_vertical_margin"

tools:context=".SettingActivity" >



<ImageButton

    android:id="@+id/imageButton1"

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:src="@drawable/makeconfess" />



<TextView

    android:id="@+id/textView1"

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:layout_alignLeft="@+id/imageButton1"

    android:layout_alignRight="@+id/imageButton1"

    android:layout_below="@+id/imageButton1"

    android:layout_marginTop="27dp"

    android:text="  Make a\nConfess"

    android:textColor="#FFFFFF"

    android:textAppearance="?android:attr/textAppearanceMedium" />

4

4 に答える 4

2

ボタンの円形を作成するには、最初に描画可能なフォルダーにxmlを作成する必要があります

circle_shape_drawable.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="oval">
    <solid 
       android:color="#666666"/>
   <size 
       android:width="120dp"
        android:height="120dp"/>
</shape>

このxmlをボタンの背景で使用します

<Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/circle_shape_drawable"
        android:text="@string/hello_world" />
于 2013-10-03T07:27:48.337 に答える