15

AndEngine を使用して Android ゲームをプログラミングしています。この図のように、数字が入った円を作成したい:

4

2 に答える 2

37

このようなもの:

circle.xml (res/drawable 内)

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval" >

    <solid android:color="#aaf" />

</shape>

および circletext.xml (res/layout 内):

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:orientation="vertical" >

    <TextView
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:layout_gravity="center"
        android:background="@drawable/circle"
        android:gravity="center"
        android:shadowColor="@android:color/white"
        android:shadowRadius="10.0"
        android:text="4"
        android:textColor="@android:color/black"
        android:textSize="18sp" />

</FrameLayout>

次のようになります。

ここに画像の説明を入力

于 2012-04-10T22:00:30.230 に答える
1

一番簡単な方法は、そのような写真をハハに入れることだと思います。常に円のある画像を使用し、その上に数字のあるテキストを重ねることができます。

于 2012-04-10T21:42:23.217 に答える