I want my fragment look like it has 3 buttons that fill the screen in both vertically and horizontally on the phone. I managed to do that somehow but I can't add another row of buttons. This is my layout... what am I doing wrong?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="#+id/button1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:id="#+id/button2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:id="#+id/button3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
</ScrollView>
</LinearLayout>
Scroll view contains only one direct child so you can not add second child directly you have to do following
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:fillViewport="true"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="#+id/button1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:id="#+id/button2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:id="#+id/button3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
<!--add here second row and other continue same -->
</LinearLayout>
</ScrollView>
</LinearLayout>
NOTE: If scrollview is only one element you going to use then you can make it root layout by removing current linearlayout from root and also remove scrollview weight for same case, it is good practice to minimize the layout hierarchy to performance improvement
First Note : scroll view remove effect of weight property
Delete the scroll view element from your layout
Second note : each button make
<Button ...
android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" />
Because 0dp let the Android system calculate the height of button Equally
Related
So my button and edit text widgets keep getting pushed upwards when I dynamically add text views to my scroll view. So the scrollview's height is also being bumped up. How do I just make sure the scroll view is fixed, I've looked at similar questions and tried implementing it but not working.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:windowSoftInputMode="stateVisible|adjustPan"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<EditText
android:id="#+id/name"
android:hint="Enter name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"/>
<EditText
android:id="#+id/phone_num"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:hint="Enter Phone Number"/>
<Button
android:id="#+id/submit"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:text="#string/submit_contact"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:isScrollContainer="false"
android:fillViewport="true">
<LinearLayout
android:id="#+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
</LinearLayout>
Try to set all heights to 0dp and give the wheightSum to the parent view. To have a fixed height of the button surround it with a LinearLayout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:windowSoftInputMode="stateVisible|adjustPan"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="2.75"
android:orientation="vertical"
tools:context=".MainActivity">
<EditText
android:id="#+id/name"
android:hint="Enter name"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"/>
<EditText
android:id="#+id/phone_num"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:hint="Enter Phone Number"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.25"
android:orientation="vertical">
<Button
android:id="#+id/submit"
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:text="test"/>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:isScrollContainer="false"
android:fillViewport="true">
<LinearLayout
android:id="#+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
</LinearLayout>
Try it out, If it dont work you may post what you have tried alredy and the code how you ad the textViews dynamicly. Good luck
How to create a android Layout where you add a smaller imageView on Top of another Image View. but only half way as the image below.
Thank.
this is the sample I try but it does not work:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/imageCover"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/big_cover_img" />
<ImageView
android:id="#+id/imageProfile"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignBottom="#+id/imageCover"
android:layout_centerHorizontal="true"
android:src="#drawable/profile_pic" />
<!-- android:layout_alignBottom="#+id/imageCover" -->
</RelativeLayout>
Use FrameLayout as parent and LinearLayout as child with weight property :
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ImageView
android:id="#+id/imageCover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="#drawable/big_cover_img" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</LinearLayout>
</LinearLayout>
<ImageView
android:id="#+id/imageProfile"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center"
android:src="#drawable/ic_launcher" />
</FrameLayout>
Set the second view to be below the first then set top margin of the bottom view to -50 dp or whatever value you want it to overlap
I have the following code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/itemLayoutView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="#dimen/list_view_layout_margin"
android:paddingRight="#dimen/list_view_layout_margin"
android:background="#color/yellow">
<LinearLayout
android:id="#+id/itemLinearLayoutView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/gameNameView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/game_list_text_size" />
<TextView
android:id="#+id/gameCreationDateView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/gray"
android:textSize="#dimen/small_text_size"
android:textStyle="italic" />
</LinearLayout>
<LinearLayout
android:id="#+id/LinearLayoutView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/red"
android:orientation="horizontal" >
<Button
android:id="#+id/infoButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/info" />
<Button
android:id="#+id/deleteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/delete" />
</LinearLayout>
</RelativeLayout>
The LinearLayout with id itemLinearLayoutView is the main layout that wrap everything in a row of listview. The problem I am having is that the second linear layout child does not take the height of the parent linear layout with id itemLinearLayoutView. Any solutions? or Problem with the code?
Your problem lies here:
android:layout_height="wrap_content"
This needs to be changed to "match_parent" in the LinearLayout which you want to be the parent's size. Also, you said
the second linear layout child does not take the height of the parent linear layout
These two layouts are not parents and children to one another. The parent is your RelativeLayout and both of your LinearLayouts are equivalent children of that RelativeLayout. Maybe this will help you debug any further problems you encounter.
just change the layout height to match parent . problem will be resolved.
<LinearLayout
android:id="#+id/itemLinearLayoutView"
android:layout_width="match_parent"
// use match_parent instead of wrap_content
android:layout_height="match_parent"
android:orientation="vertical" >
the layout needs to be nested within the first linear layout to take the parameters of it, and the value of the layout height needs to be changed. Code as Follows.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/itemLayoutView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="#dimen/list_view_layout_margin"
android:paddingRight="#dimen/list_view_layout_margin"
android:background="#color/yellow">
<LinearLayout
android:id="#+id/itemLinearLayoutView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/gameNameView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/game_list_text_size" />
<TextView
android:id="#+id/gameCreationDateView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/gray"
android:textSize="#dimen/small_text_size"
android:textStyle="italic" />
<LinearLayout
android:id="#+id/LinearLayoutView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/red"
android:orientation="horizontal" >
<Button
android:id="#+id/infoButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/info" />
<Button
android:id="#+id/deleteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/delete" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/itemLinearLayoutView"
android:layout_width="match_parent"
android:layout_height="match_parent" <!-- you should use match_parent here -->
android:orientation="vertical" >
// try this way i have used LinearLayout as parent rather than RelativeLayout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/itemLayoutView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="#dimen/list_view_layout_margin"
android:paddingRight="#dimen/list_view_layout_margin"
android:background="#color/yellow">
<LinearLayout
android:id="#+id/itemLinearLayoutView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/gameNameView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/game_list_text_size" />
<TextView
android:id="#+id/gameCreationDateView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/gray"
android:textSize="#dimen/small_text_size"
android:textStyle="italic" />
</LinearLayout>
<LinearLayout
android:id="#+id/LinearLayoutView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="right"
android:background="#color/red"
android:orientation="horizontal" >
<Button
android:id="#+id/infoButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/info" />
<Button
android:id="#+id/deleteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/delete" />
</LinearLayout>
</LinearLayout>
I want a RelativeLayout based android UI that looks like the below mock graphic:
Below is my layout xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayoutForPreview"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- surface view that contains camera preview , and seats above #+id/linearLayoutToolbar -->
<SurfaceView
android:id="#+id/surfaceViewBarcodeScanner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<!-- LinearLayout that contains toolbar that is divided into 3 sections horizontally -->
<LinearLayout
android:id="#+id/linearLayoutToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/surfaceViewBarcodeScanner"
android:orientation="horizontal" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/scanner_bottom_left" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/scanner_bottom_center_toolbar" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/scanner_bottom_right_landscape_button" />
</LinearLayout>
</RelativeLayout>
I used Eclipse GUI palette and my own editing , however the output was not what I expected, the SurfaceView seems to covering all the screen, the LinearLayout at the bottom does not appear.
Snapshot of my current result on Galaxy S3 device:
Any help will be appreciated, Thanks.
Could you please try out to modify your layout as the follows:
Define your SurfaceView and set it's layout_above value to the ID of the linear layout made in the previous step. Set the layout_alignParentTop to true.
Define your bottom linear layout and set the layout_alignParentBottom to true.
Smart code snippet with only the important parts:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android">
<SurfaceView
android:id="#+id/surfaceViewBarcodeScanner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_above="#+id/linearLayoutToolbar" />
<LinearLayout
android:id="#+id/linearLayoutToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>
I hope this will solve your problem.
you can use Linearlayout instead of Realtive Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<SurfaceView
android:id="#+id/surfaceViewBarcodeScanner"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
<LinearLayout
android:id="#+id/linearLayoutToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<!-- inside elements -->
</LinearLayout>
</LinearLayout>
else you should use android:layout_above="#+id/linearLayoutToolbar" to your surfaceview
and remove android:layout_below attribute and add android:layout_alignParentBottom="true" to your toolbar view.
// try this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/LinearLayoutForPreview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:orientation="vertical">
<LinearLayout
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="match_parent">
<SurfaceView
android:id="#+id/surfaceViewBarcodeScanner"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayoutToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:gravity="center"
android:layout_weight="1">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/scanner_bottom_left" />
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:gravity="center"
android:layout_weight="2">
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/scanner_bottom_center_toolbar" />
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:gravity="center"
android:layout_weight="1">
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/scanner_bottom_right_landscape_button" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
I have done a simple layout xml file. I have been solving my issues piece by piece. I am using scrolview, linearlayout and tableview. I have a top bar and it is locked at the top. it never moves. in the middle, I have a scrollview and I need to put my last linearlayout at the bottom as a footer and I dont want it be disappear if the user scrolls down. I want it to be locked there.
here is my code
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow
android:background="#drawable/gradient"
android:gravity="center">
.......
</TableRow>
</TableLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/sw_layout"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:background="#EEEEEE" >
<TableRow
android:id="#+id/tableRowDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
..........
</TableRow>
</TableLayout>
/*****************************************/
/* I want this to be footer at the bottom*/
/*****************************************/
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="#+id/btn_date"
android:layout_height="35dp"
android:padding="5dp"
android:drawableLeft="#drawable/calendar"
android:text="Tarih" />
<Button
android:id="#+id/btn_converter"
android:layout_height="35dp"
android:padding="5dp"
android:drawableLeft="#drawable/calendar"
android:text="Hesap" />
</LinearLayout>
/*****************************************/
/* I want this to be footer at the bottom*/
/*****************************************/
</LinearLayout>
</ScrollView>
</LinearLayout>
How can I achive to have footer locked at the bottom?
You should use RelativeLayout and in the footer layout , add the tag : android:layout_alignParentBottom="true" ; and for your ScrollView , you should put it above the footer Layout ( android:layout_above="#+id/idOfYourFooterLayout" )
Try this :
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/sw_layout"
android:layout_above="#+id/footer"
android:orientation="vertical">
//your UI...
</ScrollView>
<LinearLayout
android:id="#+id/footer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
<Button
android:id="#+id/btn_date"
android:layout_height="35dp"
android:padding="5dp"
android:drawableLeft="#drawable/calendar"
android:text="Tarih" />
<Button
android:id="#+id/btn_converter"
android:layout_height="35dp"
android:padding="5dp"
android:drawableLeft="#drawable/calendar"
android:text="Hesap" />
</LinearLayout>
</RelativeLayout>
You can set the layout_height="0dp" of your header, footer and ScrollView and define a layout_weight. Just play around with the values until you find out which works best. The resulting heights of header and footer would dynamically change with the screensize.
The values 1, 5, 1 mean that the first element takes 1/7, the second 5/7 and the last 1/7 of the available height in the parent LinearLayout.
Try
<!-- HEADER -->
<TableLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<!-- BODY -->
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="#+id/sw_layout"
android:orientation="vertical"
android:layout_weight="5">
<!-- FOOTER -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:layout_weight="1" >
Use parent Layout as RelativeLayout and add this property android:layout_alignParentBottom="true" to the footer layout, and put the LinearLayout (footer layout ) out of scrollview. like this
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" //// add this property
android:orientation="vertical" >
<Button
android:id="#+id/btn_date"
android:layout_height="35dp"
android:padding="5dp"
android:drawableLeft="#drawable/calendar"
android:text="Tarih" />
<Button
android:id="#+id/btn_converter"
android:layout_height="35dp"
android:padding="5dp"
android:drawableLeft="#drawable/calendar"
android:text="Hesap" />
</LinearLayout>
use one xml like this- >>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
</LinearLayout>
and include it as
LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
...
<!-- Overridden attributes never work. Nor do attributes like
the red background, which is specified here. -->
<include
android:id="#+id/buttons_override"
android:background="#ff0000"
android:layout_width="fill_parent"
layout="#layout/buttons"/>
</LinearLayout>
Use Relative layout as your parent layout then add your three child views as follows
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" >
<View android:id="#+id/top_view"
android:alignParentTop="true"> // Your view that as to be in Top
</View>
<ScrollView android:layout_below ="#id/top_view" > //scroll view in middle below topview
</ScrollView>
<View android:alignParentBotton="true"> //Your expected view in bottom
</View>
</RelativeLayout>
In my case, I have added these lines of code below in the Oncreate function and top of the Layout
like below
code is here:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)