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

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -