This is how it looks like Hii i want to make this screen scrollable there are certain tables i have created using linear layout but i have tried everything but cant find any solution.I used frame layout inside their is an linear layout so while running this on small screen it gets hide.I have tried add scroll view but its didnt work please help me to fix it out.
**<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="100dp"
android:background="#drawable/ic_down"
android:orientation="vertical"
android:weightSum="8.8">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.2"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:textColor="#android:color/black"
android:textSize="14dp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Quantity"
android:textColor="#android:color/black"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Hour Multiplier"
android:textColor="#android:color/black"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Shramanand Hours"
android:textColor="#android:color/black"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Courses/Camps"
android:textColor="#android:color/black"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<EditText
android:id="#+id/edtCount1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="3"
android:paddingLeft="8dp"
android:hint="__"
android:textColor="#android:color/black"
android:textCursorDrawable="#null"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:id="#+id/txtHours1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" x 10"
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:id="#+id/txtTotalHours1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="1 Day Test including Machine Test"
android:textColor="#android:color/black"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<EditText
android:id="#+id/edtCount2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="3"
android:hint="__"
android:paddingLeft="8dp"
android:textColor="#android:color/black"
android:textCursorDrawable="#null"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:id="#+id/txtHours2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="x 6"
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:id="#+id/txtTotalHours2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Manashakti Varganidar"
android:textColor="#android:color/black"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<EditText
android:id="#+id/edtCount3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="3"
android:paddingLeft="8dp"
android:hint="__"
android:textColor="#android:color/black"
android:textCursorDrawable="#null"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:id="#+id/txtHours3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="x 5"
android:textColor="#android:color/black"
android:textSize="16dp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:id="#+id/txtTotalHours3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<Button
android:id="#+id/btnSubmit"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="right|bottom"
android:textColor="#fff"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
android:background="#drawable/rounded_corner_button_bg"
android:text="Next" />
</LinearLayout>
</FrameLayout>
</LinearLayout>**
Add Scroll View with android:fillViewport="true" Attribute in Layout
And also add in menifest to resolve edittext shrink issue
<activity android:name=".MainActivity"
android:windowSoftInputMode="adjustPan"/>
Try This Code:
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="100dp"
android:orientation="vertical"
android:weightSum="8.8">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.2"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:textColor="#android:color/black"
android:textSize="14dp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Quantity"
android:textColor="#android:color/black"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Hour Multiplier"
android:textColor="#android:color/black"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Shramanand Hours"
android:textColor="#android:color/black"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Courses/Camps"
android:textColor="#android:color/black"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<EditText
android:id="#+id/edtCount1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="3"
android:paddingLeft="8dp"
android:hint="__"
android:textColor="#android:color/black"
android:textCursorDrawable="#null"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:id="#+id/txtHours1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" x 10"
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:id="#+id/txtTotalHours1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="1 Day Test including Machine Test"
android:textColor="#android:color/black"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<EditText
android:id="#+id/edtCount2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="3"
android:hint="__"
android:paddingLeft="8dp"
android:textColor="#android:color/black"
android:textCursorDrawable="#null"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:id="#+id/txtHours2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="x 6"
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:id="#+id/txtTotalHours2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Manashakti Varganidar"
android:textColor="#android:color/black"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<EditText
android:id="#+id/edtCount3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="3"
android:paddingLeft="8dp"
android:hint="__"
android:textColor="#android:color/black"
android:textCursorDrawable="#null"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:id="#+id/txtHours3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="x 5"
android:textColor="#android:color/black"
android:textSize="16dp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:id="#+id/txtTotalHours3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<Button
android:id="#+id/btnSubmit"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="right|bottom"
android:textColor="#fff"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
android:text="Next" />
</LinearLayout>
</ScrollView>
</FrameLayout>
Check text not null
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
String text1=edtCount1.getText().toString();
String text2=edtCount2.getText().toString();
String text3=edtCount3.getText().toString();
if(!isNullOrEmpty(text1)||!isNullOrEmpty(text2)||!isNullOrEmpty(text3)){
//Add your executable code here
}else {
Toast.makeText(MainActivity.this, "Please Add All Data", Toast.LENGTH_SHORT).show();
}
}
});
}
public boolean isNullOrEmpty(String str){
return str==null || str.isEmpty();
}
Related
I wanna implement the XML file in my app, please anyone give me the pattern of this XML code??
I try it with table layout but it's not like is, Please anyone help me to give me the clear concept in details or sample code of this pattern
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="1">
<TableRow>
<TextView
android:text="tumi"
android:padding="10dip" />
<TextView
android:text="ami"
android:gravity="right"
android:padding="10dip" />
</TableRow>
<TableRow>
<TextView
android:text="bal"
android:padding="10dip" />
<TextView
android:text="falau"
android:gravity="right"
android:padding="10dip" />
</TableRow>
<TableRow>
<TextView
android:text="bal"
android:padding="10dip" />
<TextView
android:text="falau"
android:gravity="right"
android:padding="10dip" />
</TableRow>
<TableRow>
<TextView
android:text="bal"
android:padding="10dip" />
<TextView
android:text="falau"
android:gravity="right"
android:padding="10dip" />
</TableRow>
<TableRow>
<TextView
android:text="bal"
android:padding="10dip" />
<TextView
android:text="falau"
android:gravity="right"
android:padding="10dip" />
</TableRow>
<TableRow>
<TextView
android:text="bal"
android:padding="10dip" />
<TextView
android:text="falau"
android:gravity="right"
android:padding="10dip" />
</TableRow>
</TableLayout>
enter image description hereenter image description here
Here is the output of my XML file
<?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">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/adview"
android:fillViewport="true"
android:layout_alignParentTop="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/gray"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:background="#color/white"
android:gravity="center"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:text="Name"
android:gravity="center"
android:textColor="#color/blue"
android:layout_height="wrap_content" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/blue" />
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:gravity="center"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="Name"
android:textColor="#color/black"
android:drawableBottom="#drawable/settings"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="1dp"
android:layout_width="match_parent"
android:orientation="horizontal"
android:background="#color/white"
android:gravity="center"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:text="Audio"
android:gravity="center"
android:textColor="#color/blue"
android:layout_height="wrap_content" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/blue" />
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:gravity="center"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:drawableBottom="#drawable/settings"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="1dp"
android:layout_width="match_parent"
android:orientation="horizontal"
android:background="#color/white"
android:gravity="center"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:text="Audio"
android:gravity="center"
android:textColor="#color/blue"
android:layout_height="wrap_content" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/blue" />
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:gravity="center"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="Name"
android:textColor="#color/black"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="1dp"
android:layout_width="match_parent"
android:orientation="horizontal"
android:background="#color/white"
android:gravity="center"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:text="Audio"
android:gravity="center"
android:textColor="#color/blue"
android:layout_height="wrap_content" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/blue" />
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:gravity="center"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="Name"
android:textColor="#color/black"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="1dp"
android:layout_width="match_parent"
android:orientation="horizontal"
android:background="#color/white"
android:gravity="center"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:text="Audio"
android:gravity="center"
android:textColor="#color/blue"
android:layout_height="wrap_content" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/blue" />
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:gravity="center"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="Name"
android:textColor="#color/black"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="1dp"
android:layout_width="match_parent"
android:orientation="horizontal"
android:background="#color/white"
android:gravity="center"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:text="Audio"
android:gravity="center"
android:textColor="#color/blue"
android:layout_height="wrap_content" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/blue" />
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:gravity="center"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="Name"
android:textColor="#color/black"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="1dp"
android:layout_width="match_parent"
android:orientation="horizontal"
android:background="#color/white"
android:gravity="center"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:text="Audio"
android:gravity="center"
android:textColor="#color/blue"
android:layout_height="wrap_content" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/blue" />
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:gravity="center"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="Name"
android:textColor="#color/black"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="1dp"
android:layout_width="match_parent"
android:orientation="horizontal"
android:background="#color/white"
android:gravity="center"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:text="Audio"
android:gravity="center"
android:textColor="#color/blue"
android:layout_height="wrap_content" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/blue" />
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:gravity="center"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="Name"
android:textColor="#color/black"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="1dp"
android:layout_width="match_parent"
android:orientation="horizontal"
android:background="#color/white"
android:gravity="center"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:text="Audio"
android:gravity="center"
android:textColor="#color/blue"
android:layout_height="wrap_content" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/blue" />
<TextView
android:layout_width="0dp"
android:layout_weight="0.5"
android:gravity="center"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="Name"
android:textColor="#color/black"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<View
android:id="#+id/adview"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true" />
</RelativeLayout>
Please have a look at the below UI (please ignore the comment in red)
Below is my attempt in making it
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="#+id/content_id_target_ranges"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context=".activities.TargetRangesActivity"
tools:showIn="#layout/app_bar_target_ranges">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/target_ranges_title_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="12dp"
android:text="#string/my_settings_target_ranges"
android:textSize="20sp" />
<TextView
android:id="#+id/target_ranges_sub_heading_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="6dp"
android:text="#string/target_ranges_sub_heading"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="12dp"
android:background="#drawable/linear_border"
android:orientation="vertical">
<TextView
android:id="#+id/target_ranges_blood_glucose_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="12dp"
android:text="#string/target_ranges_blood_glucose_text"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="15dp"
android:layout_marginTop="6dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/target_ranges_blood_glucose_pre_meal_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/target_ranges_blood_glucose_pre_meal"
android:textAlignment="center"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="#+id/target_ranges_blood_glucose_pre_meal_unit_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:text="#string/target_ranges_blood_glucose_unit"
android:textAlignment="center"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginTop="6dp"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/edit_text_style">
<EditText
android:id="#+id/target_ranges_blood_glucose_first_edit"
style="#style/EditTextStyle"
android:focusable="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="6dp"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/edit_text_style">
<EditText
android:id="#+id/target_ranges_blood_glucose_second_edit"
style="#style/EditTextStyle"
android:focusable="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="6dp"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/edit_text_style">
<EditText
android:id="#+id/target_ranges_blood_glucose_third_edit"
style="#style/EditTextStyle"
android:focusable="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:layout_width="34dp"
android:layout_height="48dp"
android:textSize="16sp"
android:textColor="#color/colorWhite"
android:background="#drawable/gray_colour_style"
android:layout_weight="1.46" />
<TextView
android:layout_width="90dp"
android:layout_height="48dp"
android:textSize="16sp"
android:background="#drawable/green_colour_style"
android:textColor="#color/colorWhite"
android:layout_weight="0.15" />
<TextView
android:layout_width="60dp"
android:layout_height="48dp"
android:textSize="16sp"
android:background="#drawable/yellow_colour_style"
android:textColor="#color/colorWhite" />
<TextView
android:layout_width="70dp"
android:layout_height="48dp"
android:textSize="16sp"
android:background="#drawable/red_colour_style"
android:textColor="#color/colorWhite"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="12dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="10dp"
android:layout_marginTop="6dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/target_ranges_blood_glucose_post_meal_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/target_ranges_blood_glucose_post_meal"
android:textAlignment="center"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="#+id/target_ranges_blood_glucose_post_meal_unit_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:text="#string/target_ranges_blood_glucose_unit"
android:textAlignment="center"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginTop="6dp"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/edit_text_style">
<EditText
android:id="#+id/target_ranges_blood_glucose_four_edit"
style="#style/EditTextStyle"
android:focusable="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="6dp"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/edit_text_style">
<EditText
android:id="#+id/target_ranges_blood_glucose_five_edit"
style="#style/EditTextStyle"
android:focusable="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="6dp"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/edit_text_style">
<EditText
android:id="#+id/target_ranges_blood_glucose_six_edit"
style="#style/EditTextStyle"
android:focusable="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="24dp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
However it generated the below UI
Notice how the colorfull bar is not aligned properly with the upper and lower text boxes, as the first image indicated via a dotted line (the dotted line shows the where the edge of each colourful tile should be, in aligned with the textboxes.
Also notice my text boxes are different than what is expected.
How can I make it as displayed in the first image?
Here I have fix your inner layout, change drawable and color.., etc
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="#+id/content_id_target_ranges"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/down_shadow"
android:orientation="vertical"
android:weightSum="20">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Texttttttttttttttttttttttttttttttttt"
android:textColor="#000" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:orientation="horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:weightSum="10">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="vertical">
<TextView
android:id="#+id/pre_meal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="kkk lkjl" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/pre_meal"
android:gravity="center"
android:text="sd/sd" />
</RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="8"
android:orientation="horizontal"
android:weightSum="6">
<EditText
android:id="#+id/one"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:background="#999698"
android:focusable="true" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<EditText
android:id="#+id/two"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:background="#999698"
android:focusable="true" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<EditText
android:id="#+id/three"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:background="#999698"
android:focusable="true" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:orientation="horizontal"
android:weightSum="9">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<TextView
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1.5"
android:background="#8c9393"
android:gravity="center"
android:text="Low"
android:textColor="#fff" />
<TextView
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="2.4"
android:background="#1dea12"
android:gravity="center"
android:text="Normal"
android:textColor="#fff" />
<TextView
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="2.2"
android:background="#f5d904"
android:gravity="center"
android:text="High"
android:textColor="#fff" />
<TextView
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1.9"
android:background="#ea0c05"
android:gravity="center"
android:layout_marginRight="2dp"
android:text="Very High"
android:textColor="#fff" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:orientation="horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:weightSum="10">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="vertical">
<TextView
android:id="#+id/pre_meals"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="kkk lkjl" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/pre_meals"
android:gravity="center"
android:text="sd/sd" />
</RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="8"
android:orientation="horizontal"
android:weightSum="6">
<EditText
android:id="#+id/four"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:background="#999698"
android:focusable="true" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<EditText
android:id="#+id/five"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:background="#999698"
android:focusable="true" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<EditText
android:id="#+id/six"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:background="#999698"
android:focusable="true" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Instead of Edittext use your TextInput layout. It is giving error while compiling so i changed it to Edittext
This is my xml file
<?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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="testFun:"
android:textColor="#color/text_black"
android:textSize="#dimen/titleTextSize"
android:textStyle="bold" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/gray" />
<RelativeLayout
android:id="#+id/layout_currentStation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"></View>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:singleLine="true"
android:text="tv_station:"
android:textColor="#color/text_black"
android:textSize="20sp" />
<TextView
android:id="#+id/tv_currentStation"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="6"
android:background="#drawable/shape_home_white_r6"
android:gravity="center_vertical"
android:singleLine="true"
android:textColor="#color/text_black"
android:textColorHint="#color/text_gray"
android:textSize="20sp" />
<ImageView
android:id="#+id/img_nomal_state_arrow"
android:layout_width="30dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:src="#drawable/icon_arrow_down" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"></View>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/testLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="test" />
</LinearLayout>
</LinearLayout>
I think android system will allocate rest of the space to "testLayout", because it is the only one specify the "layout_weight" attribute, but the result is:
The "testLayout" is just disappear, why?
Change height of both View in Relative layout(use fix height in dp).
<RelativeLayout
android:id="#+id/layout_currentStation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="5dp" // fix it in dp
android:layout_weight="1"></View>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:singleLine="true"
android:text="tv_station:"
android:textColor="#color/text_black"
android:textSize="20sp" />
<TextView
android:id="#+id/tv_currentStation"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="6"
android:background="#drawable/shape_home_white_r6"
android:gravity="center_vertical"
android:singleLine="true"
android:textColor="#color/text_black"
android:textColorHint="#color/text_gray"
android:textSize="20sp" />
<ImageView
android:id="#+id/img_nomal_state_arrow"
android:layout_width="30dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:src="#drawable/icon_arrow_down" />
<View
android:layout_width="0dp"
android:layout_height="5dp" // fix it in dp
android:layout_weight="1"></View>
</LinearLayout>
</RelativeLayout>
hope it helps.
<?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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="testFun:"
android:textColor="#color/text_black"
android:textSize="#dimen/titleTextSize"
android:textStyle="bold" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/gray" />
<RelativeLayout
android:id="#+id/layout_currentStation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"></View>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:singleLine="true"
android:text="tv_station:"
android:textColor="#color/text_black"
android:textSize="20sp" />
<TextView
android:id="#+id/tv_currentStation"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="6"
android:background="#drawable/shape_home_white_r6"
android:gravity="center_vertical"
android:singleLine="true"
android:textColor="#color/text_black"
android:textColorHint="#color/text_gray"
android:textSize="20sp" />
<ImageView
android:id="#+id/img_nomal_state_arrow"
android:layout_width="30dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:src="#drawable/icon_arrow_down" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"></View>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/testLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="test" />
</LinearLayout>
There is no orientation in the testLayout, try to add a vertical or horizontal orientation to it
EDIT
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="testFun:"
android:textColor="#color/text_black"
android:textSize="#dimen/titleTextSize"
android:textStyle="bold" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/gray" />
<RelativeLayout
android:id="#+id/layout_currentStation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"></View>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:singleLine="true"
android:text="tv_station:"
android:textColor="#color/text_black"
android:textSize="20sp" />
<TextView
android:id="#+id/tv_currentStation"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="6"
android:background="#drawable/shape_home_white_r6"
android:gravity="center_vertical"
android:singleLine="true"
android:textColor="#color/text_black"
android:textColorHint="#color/text_gray"
android:textSize="20sp" />
<ImageView
android:id="#+id/img_nomal_state_arrow"
android:layout_width="30dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:src="#drawable/icon_arrow_down" />
<View
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"></View>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/testLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="test" />
</LinearLayout>
I set the Views height to 40dp same as the TextView height and now "testLayout" is visible at the bottom
I am trying to make my app multi screen supportable for that I have created different layout folders like layout-large , layout-small ,layout-xlarge , layout-sw320dp , layout-sw480dp , I have set text size in sp in each folder and i have mentioned different text sizes for every layout folder but text is not getting changed.
Here is my xml
<?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:background="#color/gray_pager"
android:orientation="vertical"
>
<LinearLayout
android:id="#+id/firstscreen_call_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#drawable/firstscreen_layout_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.55"
android:background="#color/call_list_1"
>
<TextView
android:id="#+id/call_list_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingLeft="10dp"
android:text="Call List"
android:textSize="32sp" />
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitXY"
android:src="#drawable/cm_phone_icon"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.45"
android:background="#color/call_list_2"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
>
<TextView
android:id="#+id/call_list_client_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="350" />
<TextView
android:id="#+id/call_list_client_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Clients 99 Priority" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#color/gray_bg" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/call_list_service_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="3250" />
<TextView
android:id="#+id/call_list_service_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:maxLines="2"
android:text="Servicing Contacts" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/call_list_assigned_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="250" />
<TextView
android:id="#+id/call_list_assigned_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Assigned Contacts" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/call_list_custom_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="6" />
<TextView
android:id="#+id/call_list_custom_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Custom List" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/firstscreen_client_note"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#drawable/firstscreen_layout_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.55"
android:background="#color/client_note_1">
<TextView
android:id="#+id/client_note_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingLeft="10dp"
android:text="Client Note"
android:textSize="32sp"
android:textStyle="normal" />
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitXY"
android:src="#drawable/cm_note_icon" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.45"
android:background="#color/client_note_2"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
>
<TextView
android:id="#+id/client_note_notes_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="10" />
<TextView
android:id="#+id/client_note_notes_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:maxLines="2"
android:text="Notes Logged Today" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/client_note_meeting_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:gravity="center"
android:text="7" />
<TextView
android:id="#+id/client_note_meeting_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:maxLines="2"
android:text="Meetings Schedule" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/client_note_phone_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="6" />
<TextView
android:id="#+id/client_note_phone_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Phone Calls" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/client_note_email_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="4" />
<TextView
android:id="#+id/client_note_email_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Email(s) Sent" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/firstscreen_to_do_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#drawable/firstscreen_layout_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.55"
android:background="#color/to_do_list_1">
<TextView
android:id="#+id/todolist_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingLeft="10dp"
android:text="To-Do List"
android:textSize="32sp" />
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="5dp"
android:src="#drawable/cm_todo_icon" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.45"
android:background="#color/to_do_list_2"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/todolist_open_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="20" />
<TextView
android:id="#+id/todolist_open_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Open Task" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/todolist_expire_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="5" />
<TextView
android:id="#+id/todolist_expire_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Expiring Today" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/todolist_direct_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="25" />
<TextView
android:id="#+id/todolist_direct_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="2"
android:textSize="15sp"
android:text="Directed Calls" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#color/gray_bg" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/todolist_action_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:gravity="center"
android:text="2" />
<TextView
android:id="#+id/todolist_action_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:gravity="center"
android:maxLines="2"
android:text="Actions Pending" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/firstscreen_road_show"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#drawable/firstscreen_layout_bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.55"
android:background="#color/roadshow_1">
<TextView
android:id="#+id/roadshow_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingLeft="10dp"
android:text="Roadshow"
android:textSize="32sp" />
<ImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="5dp"
android:scaleType="fitXY"
android:src="#drawable/cm_roadshow_icon" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.45"
android:background="#color/roadshow_2"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/roadshow_meeting_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="10" />
<TextView
android:id="#+id/roadshow_meeting_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="Meetings Schedule" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/roadshow_ongoing_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="5" />
<TextView
android:id="#+id/roadshow_ongoing_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:gravity="center"
android:text="Ongoing Roadshow" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/roadshow_future_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="1" />
<TextView
android:id="#+id/roadshow_future_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="Future Roadshow" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/roadshow_mtoday_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="2" />
<TextView
android:id="#+id/roadshow_mtoday_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:text="Meetings Today" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
For best practice for text size we need to simply define the text size is sp .
and we should set text as below
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize(R.dimen.textSize));
<?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.