【发布时间】:2023-03-17 09:32:01
【问题描述】:
我正在使用 AndEngine 编写一个 Android 游戏。我想创建一个包含数字的圆圈,如下图所示:
【问题讨论】:
我正在使用 AndEngine 编写一个 Android 游戏。我想创建一个包含数字的圆圈,如下图所示:
【问题讨论】:
嗯,我想最简单的方法就是把这样的图片放在哈哈。您始终可以使用带有圆圈的图像,然后将带有数字的文本叠加在其顶部。
【讨论】:
类似这样的:
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>
看起来像这样:
【讨论】: