Posts

Showing posts with the label Android Actionbar

Add Custom View To The Right Of Toolbar

Answer : I just set layout_gravity to the right and it worked <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="0dp" android:layout_height="?android:actionBarSize" app:title="NEW REQUESTS" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="blahblah" android:layout_gravity="right" /> </android.support.v7.widget.Toolbar> You can add ViewGroups inside Toolbar <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="@dimen/toolbar_height" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> ...

Changing Overflow Icon In The Action Bar

Answer : You can with a style, but you have to add it to the main Theme declaration. <resources> <!-- Base application theme. --> <style name="Your.Theme" parent="@android:style/Theme.Holo"> <!-- Pointer to Overflow style ***MUST*** go here or it will not work --> <item name="android:actionOverflowButtonStyle">@style/OverFlow</item> </style> <!-- Styles --> <style name="OverFlow" parent="@android:style/Widget.Holo.ActionButton.Overflow"> <item name="android:src">@drawable/ic_action_overflow</item> </style> </resources> You also can change it dynamically, which I go into detail about here: Changing the Android Overflow menu icon programmatically For those who can't get it to work try this WITHOUT the "android:" namespace. <item name="actionOverflowButtonStyle">...

Android Transparent Status Bar And Actionbar

Image
Answer : I'm developing an app that needs to look similar in all devices with >= API14 when it comes to actionbar and statusbar customization. I've finally found a solution and since it took a bit of my time I'll share it to save some of yours. We start by using an appcompat-21 dependency. Transparent Actionbar : values/styles.xml : <style name="AppTheme" parent="Theme.AppCompat.Light"> ... </style> <style name="AppTheme.ActionBar.Transparent" parent="AppTheme"> <item name="android:windowContentOverlay">@null</item> <item name="windowActionBarOverlay">true</item> <item name="colorPrimary">@android:color/transparent</item> </style> <style name="AppTheme.ActionBar" parent="AppTheme"> <item name="windowActionBarOverlay">false</item> <item name="colorPrimary...