AndroidResideMenu icon indicating copy to clipboard operation
AndroidResideMenu copied to clipboard

change font size and typeface

Open abbasfisal opened this issue 9 years ago • 5 comments

tnx for sharing your lib

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

it possible?

abbasfisal avatar Aug 29 '15 13:08 abbasfisal

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

Cartman34 avatar Dec 09 '15 11:12 Cartman34

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

amankumarjain avatar Feb 08 '16 20:02 amankumarjain

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();
        }

    }

ZakharchenkoWork avatar Apr 22 '16 12:04 ZakharchenkoWork

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

sagarrishabh avatar Nov 03 '16 06:11 sagarrishabh

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);
}`

ZakharchenkoWork avatar Nov 06 '16 15:11 ZakharchenkoWork