Sunday 15 August 2010

Action Bar Back Button is not showing in Android -



Action Bar Back Button is not showing in Android -

hi have created activity extends actionbaractivity & using material theme in application. in action bar, button not showing.

i didn't find why not showing. help ?

public class registrationactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_registration); getsupportactionbar().setbackgrounddrawable(getresources().getdrawable(r.drawable.ab_background_light)); getsupportactionbar().setdisplayshowhomeenabled(true); getsupportactionbar().sethomebuttonenabled(true); getsupportactionbar().setdisplayhomeasupenabled(true);

style.xml

<style name="apptheme" parent="theme.appcompat.light"> <!--support library compatibility--> <item name="actionbarstyle">@style/mytheme.actionbarstyle</item> </style> <!-- actionbar styles --> <style name="mytheme.actionbarstyle" parent="@style/widget.appcompat.light.actionbar"> <!--support library compatibility--> <item name="titletextstyle">@style/mytheme.actionbar.titletextstyle</item> </style> <style name="mytheme.actionbar.titletextstyle" parent="@style/textappearance.appcompat.widget.actionbar.title"> <item name="android:textcolor">@android:color/white</item> </style>

androidmanifest.xml

<activity android:name=".registrationactivity" android:label="@string/title_activity_registration" > <meta-data android:name="android.support.parent_activity" android:value=".homescreenactivity" /> </activity>

thanks in advance.

add property

getsupportactionbar().setdisplayhomeasupenabled(true);

to show "back button"

android android-actionbar

No comments:

Post a Comment