Touchable view across two layouts - android

I want to make a button which lays between two layouts. I make layout in layout. In inner layout I make a button and movi it outside the layout by setting negative margin. The button is not clickable outside the wrapping layout. How to fix that?

Related

Which layout is best for showing horizontal items in android

I need to show one image and 3 textview and one radio button horizontally in android which layout using will be best that is linear layout or relative layout and why??
In my opinion, RelativeLayout will be the better choice. RadioButton will probably come at the end right? RelativeLayout can do that easily. I'm guessing ImageView comes at the left end. And 3 TextView in the middle. RelativeLayout is a good choice to implement this.
If you want to show all view in just horizontally and you also don't want to do any more customization then linear layout is good and If you want to more customization then Relative Layout(Customizations means like you want to make one view height based on another view height width or something).
Use the Constraint layout for horizontal aligning of the Views. You can set constraints and give them horizontal bias. Read about constraint layout Link
.

Adjust the layout when the soft keyboard is on in android

I have an activity where the view is like a form, where user can enter the details and At the bottom there are two buttons "save" and "cancel". The form has many number of edit boxes.
So I have taken a relative layout and put all these edit boxes in it and then put the relative layout inside scroll view. I have taken another relative layout to add "Save" and "cancel" button.
Finally I have put the scroll view and relative layout(which has buttons) in another relative layout which is the main view of my activity.
My problem is , when I click any of the edit box, keyboard will come up and it hides the buttons(Save and Cancel).
I want to make the buttons to display above the keyboard(When the keyboard is on) like in the edit contact activity of "Contacts" Application .
I am using android:windowSoftInputMode="adjustPan|adjustResize" for my activity but of no use.
I have gone through so many stack overflow questions regarding this but I am not able to achieve this.
How can I do this with my code?
in Edit Contact activity save button is added to layout in bottom, and outside of scroll view.
What you can do, to make your save and cancel button visible all the time, wheather, soft keyboard is visible, or not. Make parent layout a relativelayout, in this layout add two views one scroll view, and other relativelayout having buttons. Let Relative Layout properties layout_width=fill_parent and layout_height=wrap_content, and align_parent_bottom=true, and scroll view's layout_width=fill_parent, layout_height=fill_parent, lavout_above=#+id/rlButtons, in ScrollView, add a RelativeLayout having all the editTexts.
I got the solution .
My parent layout is Relative Layout . In this layout I added a Scroll View and a relative layout. In the scroll view I added a relative layout which is having all edit texts. In relative layout I added save and cancel buttons. I set the scroll view weight = 1.
For my activity I set android:windowSoftInputMode="adjustResize".

ExpandableListView affecting the size of Scrollview when collapsing and expanding

Let me try to explain what I want to achieve. Currently, I have a ScrollView as the main view for my layout and a linearLayout within that to place all of my content into.
In my LinearLayout, I have a bunch of textviews and a gallery, which extends out of the screen, so the user can scroll to see everything. It works.
Now, I want to add an expandableListView to the bottom of all that content, which is still in the linearLayout. The problem is when you expand the list view groups it doesn't affect the ScrollView. I had envisaged that when you expand a group it would make the linearLayout bigger, which in turn makes the scrollview bigger.
Is what I'm thinking achievable?
EDIT:
Ok I think the situation is that listViews are normally placed in a layout by themselves and have scrollviews already enabled. You just set it to fill_parent and it works fine. However, in my case, I'll need the expandableListView to display all content without scrolling, because my ScrollView will deal with that. I don't even think it possible?
It's difficult to answert without seeing your layout xml, but I think that if you set the android:layout_height of the linear layout and expandableListView to wrap_content, the first scrollView must scroll the whole view.
have you tried putting your expandable list into another linear layout and than put it in the scroll views default linear layout?

View overlapping using library components

I understand that View overlapping has been addressed for background images with components on top. However, what if I had the following, where the image from a button overlaps another view, outside of its container?
Example 1
View are not allowed to overlapped in LinearLayouts. It is used to arange child views in either vertical or horizontal manner. When views are bigger than its parent, it renders in the bounds of its parent and the rest is cut of.
You can stack child views on top of each other by using the framelayout. But from seeing your buttun, I think you can achieve it using a Relative layout. And telling the arrow to stay below button using layout_below attribute.

How to restrict bounds for Translate Animation for a view in Android?

Let me explain the scenario that I want to achieve:-
Consider the below as the Layout I have inside a Parent_Linearlayout:
[Linear Layout] (Fill_Parent, Wrap_Content)
[ScrollView]
Activity's setContentView is set to the Parent_Linearlayout
In the application, when a condition is met, I want the Scrollview to be removed from the screen and instead put another View in its place.
I've been able to do this, & when I remove the ScrollView, I'm applying translate Animation to it so that it seems as if the View has gone to the top -before removing it.
But when the animation occurs, the ScrollView translates OVER the Linear layout present above it.
How do I restrict it, so that the scrollview does not go over the linear layout, but disappears at the base of the Linearlayout. I want the linearlayout to always stay visible..
I've been trying to do this from quite some time, but I've not been able to get desired results..
Could someone kindly help me out here??
I don't quite understand your description of your layout, but the Android view system is drawn based on the ordering of the views in the hierarchy. Views added later to a parent are drawn after those added earlier. So if you always want the LinearLayout to be drawn on top of the ScrollView if/when they overlap, then declare or add the ScrollView object to its parent before the LinearLayout object.
In thinking more about this, I suppose the ordering here is important because you want the ScrollView to be placed below the LinearLayout in the parent of both of these views. Putting the ScrollView first (and thus having it painted first) would then put it above the other LinearLayout, which isn't what you want.
There are various ways to achieve what you want. For example, you could use a RelativeLayout as the parent of the views, then the ordering is not important.
Alternatively, you could place the ScrollView inside another LinearLayout (and that LinearLayout would be the second child of the overall parent layout). Then when you animate the ScrollView, it would be clipped by its immediate parent, which I believe would give you the effect you're looking for (make sure that setClipChildren() is set to true on this new intermediate LinearLayout, which it is by default, otherwise it won't clip the ScrollView as it animates out of it). Note that this approach would necessitate different animation values, since you are now animating the view outside of its parent (the new LinearLayout).

Categories

Resources