Android 如何在椭圆形内绘制圆点
我正在做一个游戏应用程序。在该应用程序中,一枚硬币必须在视图中移动。但我不知道怎么做 我的代码是:Android 如何在椭圆形内绘制圆点,android,android-layout,android-imageview,Android,Android Layout,Android Imageview,我正在做一个游戏应用程序。在该应用程序中,一枚硬币必须在视图中移动。但我不知道怎么做 我的代码是: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <gradient android:angle="135" android:centerColor
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<gradient
android:angle="135"
android:centerColor="#C4A5A5"
android:endColor="#875050"
android:startColor="#875050" />
<stroke
android:width="1dp"
android:color="#781A1A"
/>
</shape>
我的用户界面是:
我想在这些图像中移动一枚硬币。使用此代码
RoundRectShape rs = new RoundRectShape(new float[] { 15, 15, 15, 15, 15, 15, 15, 15 }, null, null);
ShapeDrawable sd = new ShapeDrawable(rs);
Button btnlogin = new Button(NativeCosmosActivity.this);
btnlogin.setBackgroundDrawable(sd);// this line converts Button to Ovel shape.. If you increase value 15 to 30,
// you will get more Ovel shape.