一直在寻找的,可在全屏幕自由拖动的view,很炫!

需导入第三方类库library
<pre name="code" class="java">布局:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:arc="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <com.capricorn.RayMenu
            android:id="@+id/ray_menu"
            android:layout_width="fill_parent"
            android:layout_height="60dp"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"/>

        <com.capricorn.ArcMenu
            android:id="@+id/arc_menu"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>

        <com.capricorn.ArcMenu
            android:id="@+id/arc_menu_2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            arc:fromDegrees="@dimen/menuFromDegrees"
            arc:toDegrees="@dimen/menuToDegrees"
            arc:childSize="@dimen/menuChildSize"/>

    </LinearLayout>
</ScrollView>

/* * Copyright (C) 2012 Capricorn * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package com.capricorn.example;import android.app.Activity;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.ImageView;import android.widget.Toast;import com.capricorn.ArcMenu;import com.capricorn.RayMenu;/** * * @author Capricorn * */public class MainActivity extends Activity {private static final int[] ITEM_DRAWABLES = { R.drawable.composer_camera, R.drawable.composer_music,R.drawable.composer_place, R.drawable.composer_sleep, R.drawable.composer_thought, R.drawable.composer_with };/** Called when the activity is first created. */@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);ArcMenu arcMenu = (ArcMenu) findViewById(R.id.arc_menu); ArcMenu arcMenu2 = (ArcMenu) findViewById(R.id.arc_menu_2); RayMenu rayMenu = (RayMenu) findViewById(R.id.ray_menu); initArcMenu(arcMenu, ITEM_DRAWABLES); initArcMenu(arcMenu2, ITEM_DRAWABLES); final int itemCount = ITEM_DRAWABLES.length;for (int i = 0; i < itemCount; i++) {ImageView item = new ImageView(this);item.setImageResource(ITEM_DRAWABLES[i]);final int position = i;rayMenu.addItem(item, new OnClickListener() {@Overridepublic void onClick(View v) {Toast.makeText(MainActivity.this, "position:" + position, Toast.LENGTH_SHORT).show();}});// Add a menu item}} private void initArcMenu(ArcMenu menu, int[] itemDrawables) { final int itemCount = itemDrawables.length; for (int i = 0; i < itemCount; i++) { ImageView item = new ImageView(this); item.setImageResource(itemDrawables[i]); final int position = i; menu.addItem(item, new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this, "position:" + position, Toast.LENGTH_SHORT).show(); } }); } }}
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值