How to set custom layout into material toolbar? - android

I'm trying to make toolbar like in this app:
play.google.com/store/apps/details?id=com.pickup.pickrup
But I can't set custom layout into toolbar.
After adding custom layout appears some margins below and above.
Help me please!

The Toolbar is just a ViewGroup, so if you have your layout or custom view you can just add it to the Toolbar using the ViewGroup#addView(View view) method. For example, if you instantiated your view and called it myView, you can do: myToolbar.addView(myView)

I have solved this problem specifying instead layout height android:layout_height="wrap_content"
this - landroid:layout_height="?actionBarSize", which is 56dp.
So margins from top and bottom have dissapeared.

Related

Only keep shadow at the bottom of the view

have this layout -
<Stepsview
android:background="#color/white"
android:elevation="#dimen/margin_16"/>
this cast shadow at the bottom as well as top :
and what i need is :
Steps view and ActionBar are 2 different views, one way I see is to combine these 2 views inside a view group and set elevation on the view group only.
Is there any other way only controlling steps view.
Achieved it by dynamically adding the steps to the top abbbar ( container for toolbar ) and setting the elevation to the app bar itself.

Custom view in toolbar under the title

I know (and use it) how to add a custom view to a Toolbar (as ActionBar). However my requirement now is to display that custom view below the title. Is there a way to achieve this without having to also include the title into that custom view? I prefer to leave the title management to the toolbar itself.
I understand the wrong thing !
You can try
View custom = getLayoutInflater().inflate(R.layout.custom,toolbar,true);
custom.setLayoutParams();
I'm going to bed.
you also can use the appbar ,
<AppBarLayout>
<Toolbar/>
<CustonView/>
<AppBarLayout/>
check the official documentation
http://developer.android.com/reference/android/support/design/widget/AppBarLayout.html

How to set expandedTitleMarginBottom for CollapsingToolbarLayout programmatically

We have some hidden views inside CollapsingToolbarLayout. So when we are making those view visible alignment of title is changed. so we need to change the value of expandedTitleMarginBottom for adjusting alignment.
How can we set expandedTitleMarginBottom for CollapsingToolbarLayout programmatically ?
For anyone searching for this : you can call setExpandedTitleMarginBottom(int px) on the collapsibleToolbarLayout

Set margin top to a Crouton object Android

Is there a way to set a margin top to a crouton ? (https://github.com/keyboardsurfer/Crouton)
You can add a margin by adding a custom view with top margin to a Crouton like this:
Crouton.make(getActivity(), myView);

Removing the margin from bottom in android Relativelayout

Hello i have used a Relativelayout in android using XML but when i see image in graphical layout there is small margin left at bottom in different screensizes.How to remove that margin.I also used a ScrollView in layout.
I think you have to set bottom margin in negative
like
android:layout_marginBottom="-10dip"
Check whether you have used padding for your layout,
Better post your layout file and/or screenshot.

Categories

Resources