I want to add a image button on the right side of the row in my linearlayout. I tried it with padding left which works but a grey shadow is visible for the padding area. How can I achieve this with linearlayout but without the shadow. Does someone know how to achieve this?
Thanks
android:gravity="right" into your XML code should do the trick. Essentially, this will force the View to head to the right part of the view.
Related
I am working on an android app and I have a scrollview, and in that, I have a linear layout in the main activity. I want to have the top and bottom borders of the linear layout to be "faded
" so as the user scrolls down the child views in the layout will "fade out" as the go down.
Here is an example of what I am trying to achieve in my linearlayout or scrollview (the "fading bottom border".
Thanks for you help!
Subby
You can do that by using the following attributes in the ScrollView.
android:requiresFadingEdge="vertical"
android:fadingEdgeLength="20dp"
If you want it on devices before API14, you need to use the following:
android:requiresFadingEdge="vertical"
android:fadingEdgeLength="20dp"
NOTE: This is actually discouraged as it is seen to have a negative performance impact on devices.
At the bottom of your layout, you can have a view above the listView, and set Gradient Color for the view, and also make it semitransparent, then you can have the effect you want.
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 ?
I want to make an about button in the top left. I tried:
android:layout_gravity:"top|left"
but it doesn't work , I searched and all what I found was using RelativeLayout and if I use that I'll have to make all my layout from beginning and it's not that good like the linear layout.
Couldn't post the code here. So this is my code on pastebin
http://pastebin.com/5EjgyB0K
Here you have given android:layout_gravity="center" to the Linear Layout so it is going to set gravity of the layout and as center and your About Button is child of layout its to going to set in center and you have given Margin_top also.Try to remove gravity amd Margin_top and you can see the result, the button will be top|left of the screen.
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.
We know that, when we scroll a listview at bottom or top of the list, we will see gradient color of yellow and black. Same thing will happen for ScrollView and HorizontalScrollView also at the edges. I want to disable the color when user scrolling these views.
is it possible to disable that color as we disable scrollbars with property
android:scrollbars="none"
If anybody know the solution please help me.
The yellow-black gradient color is actually appears when you over scroll the scroll views.
It can be eliminated by using below code in XML file of ScrollView or HorizontalScrollView
android:overScrollMode="never"
It will work for android 2.3 and above. I don't for below API levels.
Use android:fadingEdge="none" in <ListView>