Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在椭圆形内绘制圆点_Android_Android Layout_Android Imageview - Fatal编程技术网

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.