Set margin top to a Crouton object Android - 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);

Related

Change ConstraintLayout default margin

When we create a constraint to a view through the designer, it automatically creates margin for this constraint - 8dp. There are a lot of cases when I don't need that margin, so I have to manually remove it (or change to 0dp).
Is there a way we can customize a default margin for a constraint in ConstraintLayout ?
For ConstraintLayout child's you can set default margin like is shown on the image.

Setting margin or padding for all the controls in a container

On an activity in a LinearLayout I have a number of controls most of which are EditText. I wonder, is there any way to set margin or padding for those controls in one fell swoop instead of having setting it for each control one by one?
Add the margin or padding to the LinearLayout itself. On doing so then the margin and padding will apply for all its child views.(The Edit Texts)

How to set custom layout into material toolbar?

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.

Bottom margin Android LinearLayout item in XML ignored, but works in Java code

I am developing an app with an activity with member reactions on a hike event. The reactions are the yellow "balloons" which are made using a LinearLayout. Each item is constructed from a XML file (listitem_deelnemerreactie.xml) which defines the layout for a reaction item. The top level of this layout file is a LinearLayout my itself.
I want some spacing between the separate elements, as well as some right margin. The most straightforward way to so this should be: setting a bottom and right margin on the top-level LinearLAyout element of the listitem_deelnemerreactie.xml layout file.
But setting the bottom margin on the LinearLayout has no effect on the vertical spacing, though the right margin does have an effect.
The only way to be able to set a vertical margin appears to be: setting is in the Java code, after attaching the inflated view to the container.
See the two images for the effect and the code.
Though setting the margins in the code is a working workaround, I still think it is strange this cannot be achieved in the XML. Why is the bottom margin attribute ignored while the right margin is not?
Any ideas?
Have you tried to set an android:padding="10dp" for example on your elements to spaced them ?

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