2014-02-12 22 views
0

喜的朋友我在程序追加SatelliteMenu像这样SatelliteMenuItem文字与图像inandroid

SatelliteMenuItem a1=new SatelliteMenuItem(4, R.drawable.ic_4); 

    List<SatelliteMenuItem> items = new ArrayList<SatelliteMenuItem>(); 
    items.add(new SatelliteMenuItem(4, R.drawable.ic_1)); 
    items.add(new SatelliteMenuItem(4, R.drawable.ic_3)); 
    items.add(a1); 
    items.add(new SatelliteMenuItem(3, R.drawable.ic_5)); 
    items.add(new SatelliteMenuItem(2, R.drawable.ic_6)); 
    items.add(new SatelliteMenuItem(1, R.drawable.ic_2)); 
    menu.addItems(items); 

但问题是我不能够设置文本与图像SatelliteMenuItem。 请建议我如何在SatelliteMenuItem中添加文字图像

在此先感谢。

+0

需要更改库项目中的'SatelliteMenuItem'类... –

+0

如何更改此类或有任何其他库? – deep

+0

不完全知道,但你需要将String参数添加到'SatelliteMenuItem的构造函数'然后添加这个字符串作为菜单项文本....但我认为在这个菜单图标与文本没有看起来更好...所以不需要添加文本如果不是非常需要... –

回答

0

你必须改变SatelliteMenuItem的构造一样,因为它是...

public SatelliteMenuItem(int id, int imgResourceId,String string) { 
    this.imgResourceId = imgResourceId; 
    this.string=string; 
    this.id = id; 
}  

public SatelliteMenuItem(int id, Drawable imgDrawable,String string) { 
    this.imgDrawable = imgDrawable; 
    this.string=string; 
    this.id = id; 
} 

它的库SatelliteMenuItem。添加一个更多的参数为String或Textview, 尝试下面给出的这个类的一些方法。 可能会给你一些想法。