first have know isn't correct anymore google guidelines. still need know it.
i'm trying add android icon in actionbar. logo not displayed in actionbar, using appcompat
this gave answer. problem logo in middle of actionbar. want in left.
code:
<style name="apptheme" parent="theme.appcompat.light.darkactionbar"> <item name="actionbarstyle">@style/myactionbarlogo</item> </style> <style name="myactionbarlogo" parent="@style/widget.appcompat.light.actionbar"> <item name="background">@color/background_material_dark</item> <item name="logo">@drawable/icon</item> <item name="displayoptions">uselogo|showhome</item> </style>
printscreen:
anyone idea? have feeling it's stupid...
edit: added manifest:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.ap.brecht.myapplication" > <application android:allowbackup="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".mainactivity" android:label="@string/app_name" android:theme="@style/apptheme" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application> </manifest>
why don't u use toolbar?
i think in case should use toolbar.
here sample code...
<android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?android:attr/actionbarsize" android:theme="@style/toolbar" android:background="@color/primary" app:theme="@style/toolbar"> <textview android:id="@+id/toolbartitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:textsize="22dp" android:textcolor="@android:color/white"/> </android.support.v7.widget.toolbar>
that's toolbar textview in middle of toolbar. can put whatever want instead of textview used hope u.
Comments
Post a Comment