当图标变为圆形时,它应该是可点击的

时间:2014-02-24 14:29:30

标签: android graphics

我正在设置一个页面圈布局轮菜单栏。我有一些图标。当图标(图像)变为圆形时,该图标应该变为可点击。如果图标圈出并且图标以圆圈形式出现,我该怎么办?如何点击这个粉红色图像只能在圆圈

我希望粉红色的图片会是背景,图标会出现圆圈,只能点击圈子

我使用了gama_wheel_v1.0.jar 所以你知道任何图书馆的例子可以帮助我

图标: enter image description here

所选图标将来到此圈子: enter image description here

这是我的主要活动:

 import com.digitalaria.gama.wheel.Wheel;
    import android.app.Activity;
    import android.content.res.Resources;
    import android.graphics.drawable.Drawable;
    import android.os.Bundle;
    import android.widget.Button;

    public class SampleWheelActivity extends Activity {

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);               
            init();
        }

        private Wheel wheel;
        private Resources res; 
        private int[] icons = { 
                R.drawable.icon00, R.drawable.icon01, R.drawable.icon02, 
                R.drawable.icon03, R.drawable.icon04, R.drawable.icon05, 
                R.drawable.icon06, R.drawable.icon07, R.drawable.icon08, 
                R.drawable.icon09, R.drawable.icon10, R.drawable.icon11 };

        private void init() {
            res = getApplicationContext().getResources();
            wheel = (Wheel) findViewById(R.id.wheel);

            wheel.setItems(getDrawableFromData(icons));
            wheel.setWheelDiameter(400);

                }

            private Drawable[] getDrawableFromData(int[] data) {
            Drawable[] ret = new Drawable[data.length];
            for (int i = 0; i < data.length; i++) {
                ret[i] = res.getDrawable(data[i]);
            }
            return ret;
        }

    }

这是我的xml页面:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Hello, GAMA!" />

    <com.digitalaria.gama.wheel.Wheel
        android:id="@+id/wheel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:background="@drawable/Adsız"/>

</LinearLayout>

0 个答案:

没有答案