我想創建一個圓圈菜單是這樣的:圓角圓菜單在安卓
我使用ArcMenu庫。 我xml
代碼
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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.ArcMenu
android:id="@+id/arc_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
和MainActivity.java
:
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. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ArcMenu menu = (ArcMenu) findViewById(R.id.arc_menu);
ArcLayout arcLayout= new ArcLayout(this);
arcLayout.setChildSize(50);
arcLayout.setArc(0.0f, 300.0f);
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;
menu.addItem(item, new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "position:" + position, Toast.LENGTH_SHORT).show();
}
});// Add a menu item
}
}
}
和輸出不圓的方式到來。
輸出來是這樣:
請建議我如何可以設置圓角菜單 我在Android新功能所以,請幫我
你必須改變程度在ArcMenu – Piyush
剛剛擺脫的' arcLayout.setChildSize(50);''''和'arcLayout.setArc(0.0f,300.0f);'並嘗試 –
感謝兄弟,但我已經使用它不工作 – Kuldeep