菜单项和Android中的圆形图像

菜单项和Android中的圆形图像,android,menu,menuitem,Android,Menu,Menuitem,我在滑动菜单中工作,我在其中放置我的图像和一些文本。我想在我的菜单项中提供一些属性,比如我自己的文本大小、重力、中间的图像。我的代码如下。它不允许我把这些属性放进去 我的菜单项XML文件: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+i

我在滑动菜单中工作,我在其中放置我的图像和一些文本。我想在我的菜单项中提供一些属性,比如我自己的文本大小、重力、中间的图像。我的代码如下。它不允许我把这些属性放进去

我的菜单项XML文件:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/item_one"
        android:icon="@drawable/profileicon"
        android:title="Terms and Privacy">
    </item>
    <item
        android:id="@+id/item_two"
        android:icon="@drawable/dentist"
        android:title="Settings">
    </item>
    <item
        android:id="@+id/item_three"
        android:icon="@drawable/direction"
        android:title="Share">
    </item>
    <item
        android:id="@+id/item_four"
        android:icon="@drawable/as"
        android:title="Contact Us">
    </item>

</menu>

我认为您不能自定义默认菜单。相反,您可以使用自定义的
PopUpMenu
和您自己的
layout
来使用它


对于circular ImageView,您必须为此使用外部库。就我个人而言,我将其用于圆形
图像视图
s

最好的方法是使用listView而不是iff按钮。。。 创建自定义listView项 创建与项目匹配的baseAdapter 然后一切都会好起来,只需将项目添加到列表并更新它

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <com.coboltforge.slidemenu.SlideMenu
        android:id="@+id/slideMenu"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <Button
        android:id="@+id/buttonMenu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/menubutton" />

</RelativeLayout>
    slidemenu = (SlideMenu) findViewById(R.id.slideMenu);
            slidemenu.init(this, R.menu.slide, this, 333);
            // this can set the menu to initially shown instead of hidden
    //      slidemenu.setAsShown(); 
            // set optional header image
            // this demonstrates how to dynamically add menu items
            SlideMenuItem item = new SlideMenuItem();
            item.id = MYITEMID;
            item.icon = myDrawable;
            item.label = "Dynamically added item";
            slidemenu.addMenuItem(item);
            myDrawable = mImageProfile.getDrawable();
            slidemenu.setHeaderImage(myDrawable);