So every time is set my BottomNavigationView on gone the MapView gets bigger in size and when I set it back to visible it shrinks back to its original size. Is there a way to make the MapView have the size of the full screen even when the BottomNavigationView is visible ? Here is a GIF
Is there a way to make the MapView have the size of the full screen even when the BottomNavigationView is visible ?
Yes there is.
Use something like RelativeLayout as the root layout and set the width and height of the MapView to match_parent.
Also add the BottomNavigationView as the child of root layout with attribute android:layout_alignParentBottom="true".
Most importantly, do not use LinearLayout as parent and do not place the MapView and BottomNavigationView relative to each other.
Related
I know this solution can add a background to the Recyclerview . But the background is static. I want the background can scroll as the Recyclerview does
Try the following heirarchy of layouts:
ScrollView
CardView with 0 elevation and rounded corners
Relative Layout with wrap content
RecyclerView
How to bring layout or view on the top of another view or layout
enter image description hereas shown in the picture
What you want exactly?
See you can do it in two way:
Take a android.support.v7.widget.Toolbar inside it take a Relative Layout then take a Textview and RelativeLayout with an ImageView inside it. Align the RelativeLayout with ImageView on the right side and the TextView to the left of it.
Take a android.support.v7.widget.Toolbar and below it take a RelativeLayout with ImageView and align it to Right and Top
I intend achieving a layout similar to what is shown.
I have tried achieving similar behavior with Bottom sheet, percentFrameLayout, ScrollView and Coordinated layout on different occasions, but I've not being able to achieve something similar to the view that (possibly a fragment) that is scroll from the bottom of the screen and interact with other child views on the screen like the tab and the refresh button.
Any guideline and directions on how i can do this ?
You can use a RecyclerView for the cards and leave your toolbar and main content on a FrameLayout at the same level as the map. And of course a coordinator layout and proper behaviors on each element.
By doing this your recycler view will be able to interact with the toolbar and still be independent from the map.
In other words, you can reduce your problem to a single recyclerview scroll with a toolbar by making a space on the beginning of the vertical recyclerView.
What I am trying to achieve is to implement a typical texting screen, where I have a LinearLayout initially occupying the whole screen by setting the height to be fill_parent, except a RelativeLayout containing an EditText at the bottom of the screen using android:layout_alignParentBottom.
Now, I need to display an extra RelativeLayout at the bottom of the small RelativeLayout, which should reduce the height of the LinearLayout, and push the original RelativeLayout up.
Please advise what is the best way to achieve the above scenario. Thank you.
I find easier the use of RelativeLayout for cases like this.
You can define a RelativeLayout as a container of all of them and
place the others inside it.
Set your LinearLayout height to "match_parent"
Place the EditText below the LinearLayout; and the RelativeLayout,
below the EditText; using android:layout_below
Good luck friend!
I'm trying to add a scroll view inside another scroll view.
It should look like is this:
scroll view
linear layout
myprogramaticscroll view
myprogramticlinear layout
myprogramticbutton
end button
end layout
end scroll
end linear
end scroll
I'm trying to add scroll views inside of that. It goes in there, but I need to know how to set parameters correctly so I can see the whole button I have inside of my scroll view. I only see part of it, and I need to set the programatic linear layout and scroll view's width height and id. How do I do this? This is what I have so far:
//the layout I'm putting my scrollview/linearlayout/button in
LinearLayout l = (LinearLayout) findViewById(R.id.linearLayoutFavorites);
ScrollView scroll = new ScrollView(this);
LinearLayout nl = new LinearLayout(this);
ImageButton yourButton = new ImageButton(this);
nl.addView(yourButton);
scroll.addView(nl);
l.addView(scroll);
You CAN'T put a scroll view inside another scroll view, that behavior would be odd, and Android would not know how to handle your scroll on the views.
For setting layout parameters, take a look at ViewGroup.LayoutParams, there're actually quite a few subclasses of ViewGroup.LayoutParams, which are for setting layout parameters for different kinds of layouts.
You can use a Scrollview in an another Scrollview. But this is not suggestible. It will be an issue to both the user and android OS. It will leads to Memory issues and also touch issues while scrolling the views. If you are expecting the Two scrolls (Horizontal and Vertical) at a time, then it is preferble to go for TwoDSCrollView
If you want to set the Layoutparams you should look at ViewGroup.LayoutParams.
If you want to set width and height then no need to set the Layoutparams. You can get the existing params by using getLayoutParams() for the view and set width and height to that params.
If you want to place vertical in vertical scroll or horizontal in horizontal scrollview the you should set the height of the internal scrollview height to the actual height of the total childs.