Delete an empty space next to the application logo (ActionBar Sherlock)

Can someone tell me how to remove the registration to the left of the application logo?

Here's what they say about http://s9.postimage.org/ksxjpx1e7/Untitled.png

You can easily reproduce this even with ABS Demos by adding to AndroidManifest.xml

android:logo="@drawable/icon"

I even tried to edit abs__action_bar_home.xml directly, but somehow this damn addition remained.

 <view xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="fill_parent" class="com.actionbarsherlock.internal.widget.ActionBarView$HomeView" android:background="#00ff00" > <ImageView android:id="@id/abs__home" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:padding="0dip" android:layout_marginLeft="0dip" android:layout_marginBottom="@dimen/abs__action_bar_icon_vertical_padding" android:layout_marginRight="8dip" android:layout_marginTop="@dimen/abs__action_bar_icon_vertical_padding" android:adjustViewBounds="true" android:contentDescription="@null" android:scaleType="fitCenter" /> <ImageView android:id="@id/abs__up" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|left" android:layout_marginRight="-8dip" android:contentDescription="@null" android:src="?attr/homeAsUpIndicator" android:visibility="gone" tools:ignore="ContentDescription" /> </view> 
+4
source share
1 answer

As noted in one comment, padding is reserved for the up icon. The gasket is present even if the up icon is not displayed (so that the logo does not move when you hide / show the icon up). Using the action bar (and ActionBarSherlock ), there are basically 2 ways to remove a space:

1. Delete icon
The size of the up icon affects the left fill, if you place a larger image there than an arrow, the gap will be larger. If you delete it, the abyss is gone. Remember that removing the up icon may not bring the exact look. The icon and logo up partially overlap (the icon at the top has a negative right margin), so removing the icon up (does not actually set the image to nowhere, does not affect visibility) may cause the logo to be partially hidden behind the left edge of the screen.
To remove the icon up icon android:homeAsUpIndicator to @null .

 <style name="MyTheme" parent="@style/Theme.Sherlock"> <item name="homeAsUpIndicator">@null</item> <item name="android:homeAsUpIndicator">@null</item> </style> 

2. Hide the original layout and use a custom view instead
This way it works more, but you can better influence the result. You will need to place the icon and title in the user view. To hide the home layout and show the custom, you must set android:displayOptions in the style of the action bar. And then set the correct custom view in the code (you can also set it in styles, but it doesnโ€™t work in this way).

 <style name="MyTheme" parent="@style/Theme.Sherlock"> <item name="actionBarStyle">@style/MyActionBarStyle</item> <item name="android:actionBarStyle">@style/MyActionBarStyle</item> </style> <style name="MyActionBarStyle" parent="@style/Widget.Sherlock.ActionBar"> <item name="displayOptions">showCustom</item> <item name="android:displayOptions">showCustom</item> </style> 
+8
source

All Articles