Reputation: 2365
my problem is, that with appcompat I am able only to create a toolbar, which is floating. In my scenario this looks pretty ugly. Could not find any tutorial/solution, that would allow to create toolbar a non-floatable one. Do you have any ideas?
My current implementation:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
/>
UPDATE:
by floating I mean, that it's not aligned to top and right left border. Instead it's just flying attached to nothing.
Floating Toolbar with Appcompat this is a sample with floating toolbar.
https://developer.android.com/training/appbar/index.html in image here here is non-floating toolbar.
Upvotes: 0
Views: 408
Reputation: 989
What about using this:
<Toolbar
android:id="@+id/toolbar_bottom"
android:minHeight="?android:attr/actionBarSize"
android:background="?android:attr/colorAccent"
android:theme="@android:style/ThemeOverlay.Material.Dark.ActionBar"
android:popupTheme="@android:style/ThemeOverlay.Material.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
or does it need to be of type android.support.v7.widget.Toolbar
?
You can find the tutorial here: non-floating Toolbar
Upvotes: 0
Reputation: 67209
Without the complete layout XML, it is hard to provide a good answer, but based on your description of the problem, it sounds like the root layout (or whatever View contains your Toolbar
has padding set on it.
Remove all padding from the Toolbar's parent and you should get what you are looking for.
Upvotes: 1