SpecialCyCi / AndroidResideMenu

The idea of ResideMenu is from Dribbble 1 and 2. It has come true and run in iOS devices. iOS ResideMenu This project is the RefsideMenu Android version. The visual effect is partly referred to iOS version of ResideMenu. And thanks to the authors for the above idea and contribution.
MIT License
2.85k stars 1.1k forks source link

change font size and typeface #70

Open abbasfisal opened 9 years ago

abbasfisal commented 9 years ago

tnx for sharing your lib

how can i change the font size and the typeface of reside menu?

it possible?

Cartman34 commented 8 years ago

Up ! Need to improve the rendering of this menu ! Pls ! :-)

amankumarjain commented 8 years ago

is it possible to change font size, reply asap really imp?

ZakharchenkoWork commented 8 years ago

Faced the same problem. Basicly problem is that the TextView of ResideMenuItem is declared as private, and you can't access them, unless you use reflection. So what I've done, is extended ResideMenuItem and create a method setTypeface(), in which i hacked superClass to get the TextView and set the Typeface. The code of this method is below.

public void setTypeface(Typeface typeface) {
        try {
            // getting type of the field from superClass
            Field privateTextView = ResideMenuItem.class.getDeclaredField("tv_title");
            // transform this field to public
            privateTextView.setAccessible(true);
           // getting value from this field which is reference to a TextView
            TextView tv = (TextView)privateTextView.get(this);
           //finaly setting the Typface
            tv.setTypeface(typeface);
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

    }
sagarrishabh commented 7 years ago

how to extend ResideMenuItem? I got an error that "there is no default constructor available in ResideMenuItem"

ZakharchenkoWork commented 7 years ago

how to extend ResideMenuItem? I got an error that "there is no default constructor available in ResideMenuItem"

Just override other constructors.. ` public class CustomizableResideMenuItem extends ResideMenuItem {

public CustomizableResideMenuItem(Context context) {
    super(context);
}

public CustomizableResideMenuItem(Context context, int icon, int title) {
    super(context, icon, title);
}

public CustomizableResideMenuItem(Context context, int icon, String title) {
    super(context, icon, title);
}`