Android: Layout alignment - android

I have 3 'groups' of items in my layout:
Button + TextView (should be on the right side)
ImageView + ImageView + TextView (should be in center)
TextView + Button (should be on the left side)
It's like a footer for tablet.
But all my items are next to each other starting from left side.
I tried grouping them to separate layouts but it doesn't help.
Here is my code:
<LinearLayout
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal"
android:layout_gravity="bottom"
android:background="#android:color/black">
<Button
android:background="#drawable/arrow_left"
android:layout_width="50dp"
android:layout_height="match_parent"
android:id="#+id/footer_left_arrow"
android:layout_margin="10dp"/>
<TextView
android:text="text"
android:textColor="#FFFFFF"
android:textSize="20sp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="#+id/footer_left_text"/>
<ImageView
android:background="#drawable/logo"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_width="50dp"
android:layout_height="20dp"
android:layout_gravity="center"/>
<ImageView
android:background="#drawable/footer_vertical_line"
android:layout_margin="5dp"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<TextView
android:text="text"
android:textColor="#FFFFFF"
android:textSize="12sp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center" />
<TextView
android:text="text"
android:textColor="#FFFFFF"
android:textSize="20sp"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<Button
android:background="#drawable/arrow_right"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_margin="10dp" />
</LinearLayout>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_gravity="bottom"
android:background="#android:color/black"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="#+id/footer_left_arrow"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#drawable/arrow_left" />
<TextView
android:id="#+id/footer_left_text"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="text"
android:textColor="#FFFFFF"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#drawable/footer_vertical_line" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#android:drawable/ic_input_add" />
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:text="text"
android:textColor="#FFFFFF"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="text"
android:textColor="#FFFFFF"
android:textSize="20sp" />
<Button
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#drawable/arrow_right" />
</LinearLayout>
</LinearLayout>
Use this.

Related

how to set textview horizontally inside linearlayout

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/colorSlate"
android:orientation="vertical">
<TextView
android:id="#+id/hello"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#5d737e"
android:padding="20dp"
android:text="₹ 250.00"
android:textColor="#color/colorWhite" />
</LinearLayout>
<LinearLayout
android:id="#+id/world"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/colorTurquoiseBlue"
android:onClick="#{()->upgradeViewModel.gotoPremimum()}"
android:orientation="horizontal"
android:padding="20dp"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="sans-serif-medium"
android:letterSpacing="-0.03"
android:text="Go premium"
android:textColor="#color/colorWhite"
android:textSize="14.4sp"
android:textStyle="normal" />
<ImageView
android:layout_width="8dp"
android:layout_height="14dp"
android:layout_gravity="center"
android:layout_weight=".5"
app:srcCompat="#drawable/ic_arrow_white"
/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
This is my xml i am trying to display text horizontally in first linear-layout but when i try to insert another text-view below text-view inside linear-layout i am my first linear-layout get increase not fit with second layout please suggest me how to achieve this i want set text below 200 in given screen
Try this:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/hello"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#5d737e"
android:paddingStart="20dp"
android:paddingTop="10dp"
android:layout_weight="0.5"
android:textSize="15sp"
android:text="₹ 250.00"
/>
<TextView
android:id="#+id/hello1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#5d737e"
android:paddingStart="20dp"
android:paddingBottom="10dp"
android:textSize="15sp"
android:layout_weight="0.5"
android:text="₹ 250.00"
/>
</LinearLayout>
<LinearLayout
android:id="#+id/world"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:onClick="#{()->upgradeViewModel.gotoPremimum()}"
android:orientation="horizontal"
android:padding="20dp"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="sans-serif-medium"
android:letterSpacing="-0.03"
android:text="Go premium"
android:textSize="14.4sp"
android:textStyle="normal" />
<ImageView
android:layout_width="8dp"
android:layout_height="14dp"
android:layout_gravity="center"
android:layout_weight=".5"
/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Use the layout below . I have changes some attributes to default you can reset them as per your requirement.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#color/blue_end"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/hello"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="₹ 250.00"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/subscription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="4dp"
android:text="Subscription"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:id="#+id/world"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/transparent_black"
android:orientation="horizontal"
android:padding="20dp"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="sans-serif-medium"
android:letterSpacing="-0.03"
android:text="Go premium"
android:textSize="14.4sp"
android:textStyle="normal" />
<ImageView
android:layout_width="8dp"
android:layout_height="14dp"
android:layout_gravity="center"
android:layout_weight=".5"
android:src="#mipmap/ic_launcher" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:padding="10dp"
android:gravity="center"
android:layout_gravity="center"
android:background="#5d737e"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/hello"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="₹ 250.00"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/hello2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Yearly Subscription"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:id="#+id/world"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="#{()->upgradeViewModel.gotoPremimum()}"
android:orientation="horizontal"
android:padding="20dp"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="sans-serif-medium"
android:letterSpacing="-0.03"
android:text="Go premium"
android:textColor="#000"
android:textSize="14.4sp"
android:textStyle="normal" />
<ImageView
android:layout_width="8dp"
android:layout_height="14dp"
android:layout_gravity="center"
android:layout_weight=".5"
app:srcCompat="#drawable/ic_arrow_white"
/>
</LinearLayout>
</LinearLayout>
try this. :)

Not Able To align Footer at bottom of screen?

I am not able to align the footer at the Bottom of the screen.I have used RelativeLayout within which android:layout_alignParentBottom="true" but the layout is not displayed at the bottom of the screen.
loan_collection_layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="#layout/appbar_layout" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="25dp"
android:background="#156B7A"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="125dp"
android:text="Branch Office : Dhankuta"
android:textColor="#FFFFFF"
android:textSize="10sp" />
<View
android:layout_width="1dp"
android:layout_height="13dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:background="#FFFFFF" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:text="Tuesday -4 April,2017"
android:textColor="#FFFFFF"
android:textSize="10sp"
/>
</LinearLayout>
<!-- Loan collection -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginLeft="10dp"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Loan Collection"
android:textColor="#2493A7"
android:textSize="15sp"
android:textStyle="bold" />
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center"
android:layout_marginLeft="120dp"
android:layout_marginRight="2dp"
android:src="#mipmap/filter" />
<TextView
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_gravity="center"
android:text="Filter"
android:textSize="12sp"
android:textStyle="normal" />
<View
android:layout_width="1dp"
android:layout_height="15dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:background="#98A6A9" />
<ImageView
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_weight="0.01"
android:src="#mipmap/search" />
<TextView
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:text="Search"
android:textSize="12sp"
android:textStyle="normal" />
</LinearLayout>
<!-- Linear Layout for 2nd Linear Layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<!-- 2nd liner layout ist column -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/border"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="12dp"
android:layout_gravity="center"
android:layout_marginTop="7dp"
android:src="#mipmap/center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:text="Center:005"
android:textSize="10sp" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.03"
android:background="#FFFFFF" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/border"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="12dp"
android:layout_gravity="center"
android:layout_marginTop="7dp"
android:src="#mipmap/group" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:text="Group"
android:textSize="10sp" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.03"
android:background="#FFFFFF" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/border"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="12dp"
android:layout_gravity="center"
android:layout_marginTop="7dp"
android:src="#mipmap/loan_type" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:text="Loan Type"
android:textSize="10sp" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.03"
android:background="#FFFFFF" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/border"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="12dp"
android:layout_gravity="center"
android:layout_marginTop="7dp"
android:src="#mipmap/date" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:text="Date:"
android:textSize="10sp" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.03"
android:background="#FFFFFF" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/border"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="12dp"
android:layout_gravity="center"
android:layout_marginTop="7dp"
android:src="#mipmap/valuedate" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:text="value date:"
android:textSize="10sp" />
</LinearLayout>
</LinearLayout> <!-- Linear Layout 2nd ends Here -->
<!-- Linear Layout for Group code starts here-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<CheckBox
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:buttonTint="#000000" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/border_loan_collection">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Group Code"
android:textColor="#333333"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/border_loan_collection">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Member No."
android:textColor="#333333"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/border_loan_collection">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Member Name"
android:textColor="#333333"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/border_loan_collection">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Remain Price"
android:textColor="#333333"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/border_loan_collection">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Total"
android:textColor="#333333"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<!-- 3rd layout starts here -->
<!-- After third layout you have yo add listView in here and listitem should be populated through the JSON Data -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<CheckBox
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:buttonTint="#333333"
android:checked="true" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#F3F3F3">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="001"
android:textSize="12sp"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#F3F3F3">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text=" 001"
android:textSize="12sp"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#F3F3F3">
<TextView
android:id="#+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Bimala Rai"
android:textSize="12sp"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#F3F3F3">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="0.00"
android:textSize="12sp"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#F3F3F3">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="0.00"
android:textSize="12sp"
android:textStyle="normal" />
</LinearLayout>
</LinearLayout><!-- 3rd layout ends here-->
<!-- Linear Layout 4th starts here-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<CheckBox
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:buttonTint="#333333" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/border_loan_collection">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="001"
android:textColor="#333333"
android:textSize="12sp"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/border_loan_collection">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="001"
android:textColor="#333333"
android:textSize="12sp"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/border_loan_collection">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="Uranus"
android:textColor="#333333"
android:textSize="12sp"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/border_loan_collection">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="0.00"
android:textColor="#333333"
android:textSize="12sp"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/border_loan_collection">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="0.00"
android:textColor="#333333"
android:textSize="12sp"
android:textStyle="normal" />
</LinearLayout>
</LinearLayout> <!-- 4th linear layout ends here -->
<!-- Total Bottom Layout starts herel -->
<!-- Footer aligned to bottom -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_alignParentBottom="true"
android:text="Footer"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
</RelativeLayout>
How can footer be displayed at bottom of screen??
You main view is LinearLayout which does not works the way you are trying it to.
For obtaining your desired result you need your main Layout to be Relative layout and then set align bottom true to your footer.
For eg:-
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- place all your view inside this layout-->
</LinearLayout>
<!--place your footer here with align bottom property set to true-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_alignParentBottom="true"
android:text="Footer"
android:textColor="#000000"
android:textSize="20sp" />
</RelativeLayout/>
This snippet should get you going.
You have two options, either follow #Anirudh Sharma's answer, or just make your RelativeLayout's height to match_parent.
Your parent linear layout will stack your views in the orientation you have provided in your layout in order, one after the other. android:layout_alignParentBottom="true" would work only for views defined inside a RelativeLayout and not in the way you have defined.
Make your parent layout as RelativeLayout instead of LinearLayout and it would work perfectly for you!
Add following just above your footer
<View
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp" />
The problem is AlignParentBottom only works when the view is inside a Relative Layout. Your Textview is inside a Linear Layout.Put it outside of the Linear Layout and Inside the parent Relative Layout.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="#layout/appbar_layout" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="25dp"
android:background="#156B7A"
android:orientation="horizontal">
.
.
.
.
</LinearLayout>
<!-- Make sure your View is directly the child of Relative layout to use
alignParentBottom="true" -->
<!-- Footer aligned to bottom -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_alignParentBottom="true"
android:text="Footer"
android:textColor="#000000"
android:textSize="20sp" />
</RelativeLayout>
try this:
<RelativeLayout
android:id="#+id/rl"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#6AED83"
android:gravity="center" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="Footer"
android:textColor="#000000"
android:textSize="20sp" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
Try below code, it will work
<?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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:layout_weight="1">
//Your other code will be here
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="Footer"
android:layout_gravity="center"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
Whatever you want in footer make sure you write code inside main parent layout(Relative layout) so u sill set android:layout_alignParentBottom="true"
and it will remain all the time
.Note that write that code just above the </RelativeLayout> (Closing of main parent layout ). So footer never get hidden by any other layout.

Weighted layout expands too much. How to fix it?

I'm making a list of schedules. I use weightsum and layout_weight but the fields are too much expanded. How to fix it. Here is the code i=of list item There is a big space between from-to to no of seats.
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#layout/layout_bg_fav_bus_left"
android:layout_weight="7"
android:weightSum="7"
android:gravity="left"
android:layout_gravity="left">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="top"
android:orientation="horizontal"
android:layout_weight="3">
<TextView
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:textColor="#color/genaral_blue"
android:id="#+id/txt_route"
android:text="Route"
android:gravity="center_vertical|center_horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:gravity="bottom"
android:layout_weight="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/txt_avail_seats"
android:textSize="15dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="2dp"
android:textColor="#color/genaral_blue"
android:text="Available"
android:gravity="center_vertical|center_horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="2">
<ImageView
android:layout_width="32dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:src="#drawable/booking"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginBottom="2dp"
android:textColor="#color/genaral_blue"
android:textSize="15dp"
android:text="Book Your Seat"
android:gravity="center_vertical" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:weightSum="3"
android:background="#layout/layout_bg_fav_bus_right"
android:orientation="vertical"
android:layout_gravity="right"
android:gravity="right">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="5"
android:id="#+id/txt_time_now"
android:textColor="#color/alice_blue"
android:textSize="45dp"
android:textAlignment="center"
android:gravity="center_vertical|center_horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAlignment="center"
android:layout_marginBottom="3dp"
android:text="20"
android:id="#+id/txt_time_next1"
android:textColor="#color/alice_blue"
android:textSize="15dp"
android:layout_weight="1"
android:gravity="center_vertical|center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="30"
android:layout_marginBottom="3dp"
android:textColor="#color/alice_blue"
android:id="#+id/txt_time_next2"
android:textSize="15dp"
android:layout_weight="1"
android:gravity="center_vertical|center_horizontal" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

How to align ImageButtons in a layout evenly

I currently have 4 ImageButtons in a layout that takes only half of the screen height. I would like the ImageButtons to be placed evenly in the layout. Here is what I have:
<?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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="#mipmap/feed_button"
android:background="#android:color/transparent"
android:layout_weight="1" />
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="#mipmap/feed_button"
android:background="#android:color/transparent"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:orientation="horizontal">
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="#mipmap/feed_button"
android:background="#android:color/transparent"
android:layout_weight="1" />
<ImageButton
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="#mipmap/feed_button"
android:background="#android:color/transparent"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
This works, since here is the result:
The issue is, 1: I would like to add text under each button and I am not sure how that is going to work and 2: the white spots to the right and left of the ImageButtons are active, as if they were parts of the button. Is there a better way to do this?
You can do something like this
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/section1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#android:color/transparent">
<ImageButton
android:id="#+id/img1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_weight="1"
android:background="#android:color/transparent"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/img1"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="info 1"
android:textColor="#fff"
android:textSize="25sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#android:color/transparent">
<ImageButton
android:id="#+id/img2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_weight="1"
android:background="#android:color/transparent"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/img2"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="info 2"
android:textColor="#fff"
android:textSize="25sp" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#android:color/transparent">
<ImageButton
android:id="#+id/img3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_weight="1"
android:background="#android:color/transparent"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/img3"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="info 3"
android:textColor="#fff"
android:textSize="25sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#android:color/transparent">
<ImageButton
android:id="#+id/img4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_weight="1"
android:background="#android:color/transparent"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/img4"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="info 4"
android:textColor="#fff"
android:textSize="25sp" />
</RelativeLayout>
</LinearLayout>
Result
and for second part of question you should set click listener on entire relative layout. for example for tap on first cell :-
xml
android:id="#+id/section1"
JAVA
findviewbyid(R.id.section1).setOnClickListener(...)
Another (and better) alternative is to work with TableLayout:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="1">
<TableRow
android:layout_height="0dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#android:color/transparent">
<ImageButton
android:id="#+id/btn1"
android:contentDescription="#null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#mipmap/feed_button"
android:background="#android:color/transparent"/>
<TextView
android:id="#+id/txt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btn1"
android:layout_marginTop="10dp"
android:layout_centerHorizontal="true"
android:text="Text 1"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#android:color/transparent">
<ImageButton
android:id="#+id/btn2"
android:contentDescription="#null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#mipmap/feed_button"
android:background="#android:color/transparent"/>
<TextView
android:id="#+id/txt2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btn2"
android:layout_marginTop="10dp"
android:layout_centerHorizontal="true"
android:text="Text 2"/>
</RelativeLayout>
</TableRow>
<TableRow
android:layout_height="0dp"
android:layout_weight="1">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#android:color/transparent">
<ImageButton
android:id="#+id/btn3"
android:contentDescription="#null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#mipmap/feed_button"
android:background="#android:color/transparent"/>
<TextView
android:id="#+id/txt3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btn3"
android:layout_marginTop="10dp"
android:layout_centerHorizontal="true"
android:text="Text 3"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#android:color/transparent">
<ImageButton
android:id="#+id/btn4"
android:contentDescription="#null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#mipmap/feed_button"
android:background="#android:color/transparent"/>
<TextView
android:id="#+id/txt4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btn4"
android:layout_marginTop="10dp"
android:layout_centerHorizontal="true"
android:text="Text 4"/>
</RelativeLayout>
</TableRow>
</TableLayout>

Scrollview doesnt work when scrolled on webview on android version lower than 16

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fbutton="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/progressBarLL"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#color/app_background_color"
android:gravity="center"
android:visibility="visible">
<ProgressBar
android:id="#+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollableContent"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="4dp">
<LinearLayout
android:id="#+id/navigationControlLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="4">
<ImageView
android:id="#+id/previousPageImageView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/previous_page_darken" />
<TextView
android:id="#+id/dealsPageNumberStatus"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="center"
android:text="1/50"
android:textSize="#dimen/text_size_medium" />
<ImageView
android:id="#+id/nextPageImageView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/next_page_darken" />
</LinearLayout>
<LinearLayout
android:id="#+id/dealsFragmentLinearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="#dimen/margin_large"
android:layout_marginLeft="#dimen/margin_normal"
android:layout_marginRight="#dimen/margin_normal"
android:layout_marginTop="4dp"
android:background="#drawable/background_with_shadow"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6"
android:orientation="horizontal"
android:paddingTop="0dp">
<ImageView
android:id="#+id/dealsFragmentImage"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="2"
android:background="#android:color/transparent"
android:minHeight="#dimen/min_image_height"
android:padding="5dp"
android:src="#drawable/test_logo" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4.00"
android:orientation="vertical"
android:padding="#dimen/padding_normal">
<TextView
android:id="#+id/dealsFragmentTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="This text is intentionally made larger to go beyound 2 lines"
android:textSize="#dimen/text_size_medium"
android:padding="#dimen/padding_normal" />
<TextView
android:id="#+id/dealsTimeSubmitted"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="2"
android:text="about an hour ago "
android:textColor="#color/light_grey"
android:textSize="#dimen/text_size_small"
android:padding="#dimen/padding_normal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:orientation="horizontal"
android:padding="#dimen/padding_normal">
<TextView
android:id="#+id/dealsCurrentPrice"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="left|center"
android:padding="4dp"
android:text="Rs. 135"
android:textColor="#color/deals_blue"
android:textSize="#dimen/text_size_large"
android:textStyle="bold" />
<TextView
android:id="#+id/dealsOffPercent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="left|center"
android:padding="4dp"
android:text="(90% off)"
android:textColor="#color/deals_blue"
android:textSize="#dimen/text_size_medium" />
<TextView
android:id="#+id/dealsOriginalPrice"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="left|center"
android:padding="4dp"
android:text="1235698"
android:singleLine="true"
android:textColor="#color/light_grey"
android:textSize="#dimen/text_size_small" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="left|center"
android:paddingLeft="4dp"
android:text="#string/submitted_by"
android:textColor="#color/light_text"
android:textSize="#dimen/text_size_small" />
<TextView
android:id="#+id/dealsFragmentSubmittedBy"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="left|center"
android:text=" aniket007"
android:textColor="#color/deals_blue"
android:textSize="#dimen/text_size_small" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="left|center"
android:text=" in "
android:textColor="#color/light_text"
android:textSize="#dimen/text_size_small" />
<TextView
android:id="#+id/dealsCategory"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:ellipsize="end"
android:gravity="left|center"
android:maxLines="1"
android:paddingRight="4dp"
android:text="Mobiles and Mobile Accessories"
android:textColor="#color/deals_blue"
android:textSize="#dimen/text_size_small" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="10dp"
android:background="#color/item_separator"
android:layout_marginLeft="#dimen/margin_normal"
android:layout_marginRight="#dimen/margin_normal" />
<WebView
android:id="#+id/dealDetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:contentDescription="#string/top_deals"
android:textSize="#dimen/text_size_medium" />
<include
layout="#layout/list_item_deal_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
<!--<LinearLayout
android:id="#+id/dealsFragmentCommentLinearLayout"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="#color/deals_footer"
android:orientation="horizontal">
<View
android:layout_width="1dip"
android:layout_height="fill_parent"
android:background="#color/flat_grey" />
<ImageView
android:id="#+id/dealsFragmentLikeImage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:src="#drawable/comment_icon" />
<View
android:layout_width="1dip"
android:layout_height="fill_parent"
android:background="#color/flat_grey" />
<ImageView
android:id="#+id/dealsFragmentDislikeImage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:src="#drawable/comment_icon" />
<View
android:layout_width="1dip"
android:layout_height="fill_parent"
android:background="#color/flat_grey" />
<ImageView
android:id="#+id/dealsFragmentShareImage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:src="#drawable/popularity_icon" />
<View
android:layout_width="1dip"
android:layout_height="fill_parent"
android:background="#color/flat_grey" />
</LinearLayout>
<info.hoang8f.widget.FButton
android:id="#+id/viewCommentsButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:minHeight="#dimen/fb_button_min_height"
android:text="#string/viewComments"
android:textColor="#android:color/white"
android:textSize="#dimen/text_size_medium"
fbutton:buttonColor="#color/fbutton_default_color"
fbutton:cornerRadius="5dp"
fbutton:shadowColor="#color/fbutton_default_shadow_color"
fbutton:shadowEnabled="true"
fbutton:shadowHeight="2dp" />-->
<info.hoang8f.widget.FButton
android:id="#+id/buyNowButtonPlaceHolder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:minHeight="#dimen/fb_button_min_height"
android:text="#string/buy_now"
android:textColor="#android:color/white"
android:textSize="#dimen/text_size_medium"
android:visibility="invisible"
fbutton:buttonColor="#color/fbutton_default_color"
fbutton:cornerRadius="5dp"
fbutton:shadowColor="#color/fbutton_default_shadow_color"
fbutton:shadowEnabled="true"
fbutton:shadowHeight="2dp" />
</LinearLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#ccffffff">
<info.hoang8f.widget.FButton
android:id="#+id/buyNowButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:minHeight="#dimen/fb_button_min_height"
android:minWidth="#dimen/buy_now_button_width"
android:text="#string/buy_now"
android:textColor="#android:color/white"
android:textSize="#dimen/text_size_medium"
fbutton:buttonColor="#color/fbutton_default_color"
fbutton:cornerRadius="5dp"
fbutton:shadowColor="#color/fbutton_default_shadow_color"
fbutton:shadowEnabled="true"
fbutton:shadowHeight="2dp" />
</RelativeLayout>
</RelativeLayout>
I am using WebView inside ScrollView and it does work correctly on android versions higher than 16. But on lower version page do not get scrolled when scrolled on webview. Page does get scrolled from right side of page. Links too do not open when clicked on left side but does open from right side.
found few solutions like android:hardwareAccelerated="true", but not working.

Categories

Resources