android - Change the actionbar homeAsUpIndicator Programamtically -


i used following hack change homeasupindicator programmatically.

int upid = resources.getsystem().getidentifier("up", "id", "android"); if (upid > 0) {     imageview = (imageview) findviewbyid(upid); up.setimageresource(r.drawable.ic_action_bar_menu); up.setpadding(0, 0, 20, 0); } 

but not working on new phones (htc one, galaxy s3, etc). there way can changed uniformly across devices. need changed on home screen. other screens have default one. cannot use styles.xml

this did acheive behavior. inherited base theme , created new theme use theme specific activity.

<style name="customactivitytheme" parent="apptheme">     <item name="android:homeasupindicator">@drawable/custom_home_as_up_icon</item> </style> 

and in android manifest made activity theme above.

<activity         android:name="com.example.customactivity"         android:theme="@style/customactivitytheme" > </activity> 

works great. update again when check on devices have. @faylon pointing in right direction


Comments

Popular posts from this blog

html - Cut text on left side inside button while centering -

java - Last square of 8x8 grid not drawn, using two nested FOR loops -

What design pattern is this code in Javascript? -