Move an element in relative layout to absolute edge of the screen - android

Is it possible to move a button or any other element in relative layout to the absolute edge of the sreen? If I drag a certain element to the edge of the layout, eclipse will automatically place it a few dp away from the edge. It'll basically just create a small space between a button and the end of the creen. Is it possible to bypass that?
I know buttons aren't meant to be that close to the edge of the screen anyway, but I need it for a certain thing.

The normal button has a little padding by default, because the buttons backgroundimage is a 9-patch image with padding left, right and on bottom. That's why you see the space between button and screen.
To solve this you can use a custom button. For example change the backgroundimage of button like this android:background="#drawable/image".

Related

Can the space of Safe Area be filled with anything?

I would like to have a bottom aligned button which has text positioned above safe area in a way that allows me to fill that space with the color of button and, ideally, is clickable too.
I was thinking about adding a Container with Gesture Detector there but can't figure out how to do it in a way that won't ruin layout on phones without safe area. That's how huge it looks when wrapped in SafeArea. Ideally there would be little to no margin above text in this button, something like this.
You can use flutter_screenutil instead of SafeArea, knowing the bottom and top safearea height by these 2 functions:
ScreenUtil.bottomBarHeight //Bottom safe zone distance, suitable for buttons with full screen
ScreenUtil.statusBarHeight //Status bar height , Notch will be higher Unit px
you can then control the height of safearea yourself

android imageview auto scaled without overlap other view

I have a linear layout(mLL) that fit the whole screen.
Within it, there are 3 things.
That is a textview contains a mulit line string.
It is followed by a imageview. The imageview fit the remain area of screen (problem here).
That I added a horizontal menubar (radiogroup with some image buttons) and aligned it to the bottom of linear layout(mLL).
The result is the radiogroup button show on top of the image.
What I hope is, the imageview fit itself to occupied the whole screen, but left sufficient space for textview and a horizontal radiogroup button.
I know I can use program code to scale the image, but I wonder if there are some attributes or correct xml layout that can intuitively create above arrangement? I mean, the arrangement of some text, followed by picture, and then a menubar is so common that should have a better way to implement it.
P.S. I tried to add the menubar before the imageview. Consequently, the imageview shows on top of menubar, i.e. menubar is partially hidden.
P.S2. The menubar need to tough the bottom of screen. So, it should be added to relative to mLL.

Make a view fall of the screen

I have a RelativeLayout where I add and position Views (Buttons, TextViews) by changing their top and left margins. I can position them half outside the layout on the top and left side, but when I try to move them half outside the layout on the bottom or right side, they change shape to stay inside the layout.
How can I make the views fall outside the screen instead of resize them self?
Giving them a width does not solve it.
You can't do it using RelativeLayout, which always need to fit the screen size.
You can use ScrollView wich extends a FrameLayout and can be larger then the screen.
Regards.

hide a portion of button under textedit

I am trying to achieve exactly something like this
- a text view on left and a button to its right
- Button should be wrap_text
- textedit should occupy the remaining space
If you carefully see the image in the image the buttons left curved border are hiding under the text view.
I am using relative layout to adjust the button height according to this
How to get a button's height to match another element's height?
But I am unable to hide the left portion of the button.
Actually the Button isn't hidden under the EditText.
They used custom background for that button, which is 9 patch png image. You can achieve this by providing your 9 patch images for both EditText and Button with 0 margin between them.
Here is a nice tutorial about using 9 patch png.
Another post to consider is Buttons with (niceley) stretched background.
add android:layout_marginLeft="-10dp" to the button

overlay imageview without pushing layouts down

a picture is worth a thousand words, so my question should basically be self-explanatory with the attached image: How to get rightmost screen instead of the center screen?
turns out i cannot attach images directly yet, so i have to link to it right now:
How to get rightmost screen instead of the center screen?
just to add, i realise that it is not really possible to have the framelayout NOT expand as shown in screen 2b, but my question remains as to how to achieve such an overlay without pushing the Other layouts down i.e. the bottom part of the imageview would be on top of the top right part of the other layouts
perhaps you could have the image you are dynamically adding be outside the frame layout. ie have a relative layout contain both framelayouts and the imageview – jkhouw1 1 hour ago

Categories

Resources