I'm trying to create a layout that has a 4 categories on the page, and in each one 2 spinners with a title. However at the moment my layout is all over the place when i run an emulator. How can i fix this? i feel like i'm not understanding the concept of the layout properly since everything i add becomes rigid to the layout and i can't easily move things.
layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".Page1Fragment">
<TextView
android:id="#+id/TextView0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginTop="25dp"
android:background="#A0DD0A"
android:text="TITLE" />
<LinearLayout
android:id="#+id/LinearLayoutTop"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/LinearLayoutTopSub"
android:layout_width="match_parent"
android:layout_height="134dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="horizontal">
<TextView
android:id="#+id/TextView1"
android:layout_width="81dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:text="Weight" />
<Spinner
android:id="#+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="55dp"
android:layout_marginRight="25dp" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/spinner"
android:layout_marginLeft="0dp"
android:layout_marginTop="55dp"
android:layout_marginRight="25dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/LinearLayoutTopSub2"
android:layout_width="match_parent"
android:layout_height="134dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="horizontal">
<TextView
android:id="#+id/TextView2"
android:layout_width="150dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:text="Computer" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="55dp"
android:layout_marginRight="25dp" />
<Spinner
android:id="#+id/spinner3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/spinner2"
android:layout_marginLeft="0dp"
android:layout_marginTop="85dp"
android:layout_marginRight="30dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:background="#FFFFFF">
<LinearLayout
android:id="#+id/LinearLayoutTopSub3"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="horizontal">
<TextView
android:id="#+id/TextView4"
android:layout_width="150dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:text="Distance" />
<Spinner
android:id="#+id/spinner4"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="55dp"
android:layout_marginRight="25dp" />
<Spinner
android:id="#+id/spinner5"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="55dp"
android:layout_marginRight="0dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/LinearLayoutTopSub4"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="horizontal">
<TextView
android:id="#+id/TextView5"
android:layout_width="150dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:text="Other" />
<Spinner
android:id="#+id/spinner6"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="55dp"
android:layout_marginRight="25dp" />
<Spinner
android:id="#+id/spinner7"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="55dp"
android:layout_marginRight="0dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
I have added new linear and removed weight. try this one.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".Page1Fragment">
<TextView
android:id="#+id/TextView0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginTop="25dp"
android:background="#A0DD0A"
android:text="TITLE" />
<!-- adding new linear -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/LinearLayoutTop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/LinearLayoutTopSub"
android:layout_width="wrap_content"
android:layout_height="134dp"
android:background="#FFFFFF"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/TextView1"
android:layout_width="150dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:background="#FFFFFF"
android:text="Weight" />
<Spinner
android:id="#+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/LinearLayoutTopSub3"
android:layout_width="wrap_content"
android:layout_height="134dp"
android:background="#FFFFFF"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/TextView3"
android:layout_width="150dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:background="#FFFFFF"
android:text="Computer" />
<Spinner
android:id="#+id/spinner3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="#+id/spinner4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/LinearLayoutBot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/LinearLayoutBotSub"
android:layout_width="wrap_content"
android:layout_height="134dp"
android:background="#FFFFFF"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/TextView4"
android:layout_width="150dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:background="#FFFFFF"
android:text="Distance" />
<Spinner
android:id="#+id/spinner9"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="#+id/spinner7"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/LinearLayoutTopSub2"
android:layout_width="wrap_content"
android:layout_height="134dp"
android:background="#FFFFFF"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/TextView2"
android:layout_width="150dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:background="#FFFFFF"
android:text="Others" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="#+id/spinner5"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Related
I have one fragment whose layout i want to show above keyboard when softkeyboard opens up. The layout is:
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="#drawable/ic_bg_splash"
android:fitsSystemWindows="true">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2">
<ImageButton
android:id="#+id/previous"
android:layout_width="37.5dp"
android:layout_height="37.5dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="22dp"
android:background="#drawable/left"
android:padding="7dp" />
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="12dp">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="7dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginTop="7dp"
android:layout_marginRight="12dp"
android:layout_marginBottom="7dp"
android:orientation="vertical">
<ImageView
android:id="#+id/subCat"
android:layout_width="157.5dp"
android:layout_height="157.5dp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="50dp"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="12dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/nunito"
android:paddingLeft="20dp"
android:text="#string/enter_answer"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
<LinearLayout
android:layout_width="262.5dp"
android:layout_height="52.5dp"
android:layout_marginTop="7dp"
android:background="#drawable/answer_bg"
android:orientation="horizontal">
<EditText
android:id="#+id/answer"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="8"
android:background="#null"
android:fontFamily="#font/nunito"
android:inputType="textNoSuggestions"
android:maxLines="1"
android:padding="7dp"
android:textColor="#android:color/white"
android:textSize="15sp" />
<ImageView
android:id="#+id/wrong_answer"
android:layout_width="27.5dp"
android:layout_height="28dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:src="#drawable/red_cross"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="22dp"
android:layout_marginBottom="27dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/reset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/nunito"
android:text="#string/reset"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="14.3sp" />
<TextView
android:id="#+id/submit_ans"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:background="#drawable/white_rounded"
android:fontFamily="#font/nunito_semibold"
android:paddingLeft="17dp"
android:paddingTop="7dp"
android:paddingRight="17dp"
android:paddingBottom="7dp"
android:text="#string/submit"
android:textAllCaps="true"
android:textColor="#color/lineColor"
android:textSize="14.3sp" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2">
<ImageButton
android:id="#+id/next"
android:layout_width="37.5dp"
android:layout_height="37.5dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="22dp"
android:background="#drawable/right" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:id="#+id/write_dark"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#70000000"
android:elevation="10dp"
android:visibility="gone">
<ImageView
android:id="#+id/write_success"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="10dp" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
I have tried by setting windowssoftinputmode to adjustResize in manifest and also using fitsystemwindows to true in the fragment parent layout but still it is not working and using scrollview as parent layout instead of relativelayout. So please suggest me any workaround for this issue.
Edit: Added below activity.xml layout:
Below is the host activity layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/language_bg"
android:orientation="vertical"
tools:context=".home.HomeActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/bottom_rounded">
<RelativeLayout
android:id="#+id/taskBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_gravity="center_vertical"
android:layout_weight="1.7"
android:paddingLeft="30dp"
android:paddingTop="5dp">
<ImageView
android:layout_width="143dp"
android:layout_height="56dp"
android:layout_gravity="left|center_vertical"
android:src="#drawable/hello_logo" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_weight="3"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/learn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="33dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:src="#drawable/learn_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="#string/learn"
android:textColor="#color/lineColor"
android:textSize="11sp" />
<View
android:id="#+id/learn_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="10dp"
android:background="#color/lineColor" />
</LinearLayout>
<LinearLayout
android:id="#+id/practice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="42dp"
android:layout_height="28dp"
android:src="#drawable/practice_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="#string/practice"
android:textColor="#color/lineColor"
android:textSize="11sp" />
<View
android:id="#+id/practice_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="10dp"
android:background="#color/lineColor"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:layout_marginRight="30dp"
android:layout_weight="1.3"
android:gravity="right"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/unlock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="26.5dp"
android:layout_height="32dp"
android:src="#drawable/unlock_blue" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="#string/unlock"
android:textColor="#color/lineColor"
android:textSize="11dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/language"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:gravity="center_horizontal|bottom"
android:orientation="vertical">
<ImageView
android:layout_width="33dp"
android:layout_height="30dp"
android:layout_marginTop="2dp"
android:src="#drawable/language" />
<TextView
android:id="#+id/language_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:text="#string/lang"
android:textAllCaps="true"
android:textColor="#color/lineColor"
android:textSize="11dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/appbar_practice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimaryDark"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="12dp"
android:visibility="gone">
<LinearLayout
android:id="#+id/read_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="23.5dp"
android:layout_height="17.5dp"
android:background="#drawable/icon_read" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:fontFamily="#font/nunito_semibold"
android:text="#string/read"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
</LinearLayout>
<View
android:id="#+id/read_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="12dp"
android:background="#android:color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/speak_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="16.5dp"
android:layout_height="21.5dp"
android:background="#drawable/icon_speak" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:fontFamily="#font/nunito_semibold"
android:text="#string/speak"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
</LinearLayout>
<View
android:id="#+id/speak_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="12dp"
android:background="#android:color/white"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:id="#+id/listen_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="18.5dp"
android:layout_height="18.5dp"
android:background="#drawable/icon_listen" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:fontFamily="#font/nunito_semibold"
android:text="#string/listen"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
</LinearLayout>
<View
android:id="#+id/listen_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="12dp"
android:background="#android:color/white"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:id="#+id/write_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="17dp"
android:layout_height="19dp"
android:background="#drawable/icon_write" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:fontFamily="#font/nunito_semibold"
android:text="#string/write"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
</LinearLayout>
<View
android:id="#+id/write_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="12dp"
android:background="#android:color/white"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
<FrameLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
Try to put your scrollView into relative Layout.
After commenting this from my activity onCreate() it started working:
this.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
)
My scollview is not scrolling. I tried putting the scrollView inside a linear layout but still not working. I am trying the scroll view in landscape mode.Also bonus question, is there a layout that i can wrap my code into so that i can have my app be perfect on all screen sizes from small screen to big tablets.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/bg"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="110dp"
android:padding="10dp"
android:weightSum="2">
<LinearLayout
android:id="#+id/number"
android:layout_width="150dp"
android:layout_height="130dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="0dp"
android:background="#color/category_colors"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/numbers1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NUMBERS"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout6"
android:layout_width="150dp"
android:layout_height="130dp"
android:layout_alignBottom="#+id/linearLayout9"
android:layout_marginBottom="0dp"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:background="#color/category_colors"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1"
tools:ignore="RtlCompat">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/family1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FAMILY"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout7"
android:layout_width="150dp"
android:layout_height="130dp"
android:layout_alignBottom="#+id/number"
android:layout_marginBottom="0dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toEndOf="#+id/number"
android:background="#color/category_home"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1"
android:layout_toRightOf="#+id/number">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/colors1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="COLORS"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout8"
android:layout_width="150dp"
android:layout_height="130dp"
android:layout_alignBottom="#+id/linearLayout7"
android:layout_marginBottom="0dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toEndOf="#+id/linearLayout7"
android:layout_toRightOf="#+id/linearLayout7"
android:background="#color/category_home"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/nouns1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="VERBS"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout9"
android:layout_width="150dp"
android:layout_height="130dp"
android:layout_below="#+id/linearLayout7"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:layout_toLeftOf="#+id/linearLayout8"
android:layout_toStartOf="#+id/linearLayout8"
android:background="#color/category_colors"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/verbs1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NOUNS"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout10"
android:layout_width="150dp"
android:layout_height="130dp"
android:layout_alignBottom="#+id/linearLayout9"
android:layout_marginBottom="0dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toEndOf="#+id/linearLayout9"
android:layout_toRightOf="#+id/linearLayout9"
android:background="#color/category_colors"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/phrases1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PHRASES"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
Try this as per your layout use HorizontalScrollView
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorPrimary"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="110dp"
android:padding="10dp"
android:weightSum="2">
<LinearLayout
android:id="#+id/number"
android:layout_width="150dp"
android:layout_height="130dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="0dp"
android:background="#color/cardview_shadow_end_color"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/kid" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NUMBERS"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout6"
android:layout_width="150dp"
android:layout_height="130dp"
android:layout_alignBottom="#+id/linearLayout9"
android:layout_marginBottom="0dp"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:background="#color/colorRed"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1"
tools:ignore="RtlCompat">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/kid" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FAMILY"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout7"
android:layout_width="150dp"
android:layout_height="130dp"
android:layout_alignBottom="#+id/number"
android:layout_marginBottom="0dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toEndOf="#+id/number"
android:background="#color/colorRed"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1"
android:layout_toRightOf="#+id/number">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/kid" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="COLORS"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout8"
android:layout_width="150dp"
android:layout_height="130dp"
android:layout_alignBottom="#+id/linearLayout7"
android:layout_marginBottom="0dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toEndOf="#+id/linearLayout7"
android:layout_toRightOf="#+id/linearLayout7"
android:background="#color/colorRed"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/kid" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="VERBS"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout9"
android:layout_width="150dp"
android:layout_height="130dp"
android:layout_below="#+id/linearLayout7"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:layout_toLeftOf="#+id/linearLayout8"
android:layout_toStartOf="#+id/linearLayout8"
android:background="#color/cardview_shadow_end_color"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/kid" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NOUNS"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout10"
android:layout_width="150dp"
android:layout_height="130dp"
android:layout_alignBottom="#+id/linearLayout9"
android:layout_marginBottom="0dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_toEndOf="#+id/linearLayout9"
android:layout_toRightOf="#+id/linearLayout9"
android:background="#color/colorRed"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/kid" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PHRASES"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</HorizontalScrollView>
I have my container.xml :
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/toolbar"
android:id="#+id/techScrolView"
>
<LinearLayout
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"
android:layout_marginTop="15dp"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:layout_marginLeft="30dp">
<FrameLayout
android:id="#+id/photo_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/profileDisplayImg"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:background="#drawable/circle"
android:gravity="center"
android:text="#string/hint_image"
android:textSize="#dimen/hint_size"
/>
</RelativeLayout>
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:text="#string/edit_detail"
android:textColor="#color/white"
android:drawableLeft="#drawable/pencil"
android:id="#+id/edit_profile"
/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:id="#+id/profileName"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:padding="2dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_horizontal"
android:id="#+id/profilePlace"
android:padding="2dp"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:drawableRight="#drawable/map_marker_white"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#color/white"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:padding="6dp"
android:layout_marginTop="10dp"
android:baselineAligned="false"
android:layoutDirection="rtl"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/social_media_circle"
android:layout_marginRight="30dp"
android:layout_marginLeft="30dp"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/google_plus"
android:id="#+id/profileGoogle"
android:layout_marginRight="5dp"
android:layout_centerVertical="true"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/social_media_circle"
android:layout_marginRight="30dp"
android:layout_marginLeft="30dp"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/facebook"
android:id="#+id/profileFace"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/social_media_circle"
android:layout_marginRight="30dp"
android:layout_marginLeft="30dp"
android:layout_gravity="left"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/white_phone"
android:id="#+id/profileCall"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="40dp"
android:layout_marginRight="20dp"
android:layout_marginTop="15dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/career"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/text_display_color"
android:textSize="#dimen/profile_info_text_size"
android:text=""
android:padding="3dp"
android:layout_gravity="center|left"
android:gravity="left"
android:layout_marginRight="80dp"
android:id="#+id/profileSkills"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/years_experince"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/text_display_color"
android:layout_gravity="center"
android:gravity="left"
android:layout_marginRight="18dp"
android:textSize="#dimen/profile_info_text_size"
android:text=""
android:padding="5dp"
android:id="#+id/profileExperince"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/current_salary"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/text_display_color"
android:layout_gravity="center"
android:gravity="left"
android:layout_marginRight="48dp"
android:textSize="#dimen/profile_info_text_size"
android:text=""
android:padding="5dp"
android:id="#+id/profileSalary"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/kafeel_type"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/text_display_color"
android:layout_gravity="center"
android:gravity="left"
android:layout_marginRight="45dp"
android:textSize="#dimen/profile_info_text_size"
android:text=""
android:padding="5dp"
android:id="#+id/profileKafeel"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/nationalty"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:id="#+id/profileNationalty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="78dp"
android:textColor="#color/text_display_color"
android:gravity="left"
android:padding="5dp"
android:text=""
android:textSize="#dimen/profile_info_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/statuse"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:id="#+id/profileStatue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="90dp"
android:gravity="left"
android:padding="5dp"
android:text=""
android:textColor="#color/text_display_color"
android:textSize="#dimen/profile_info_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/drive"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:id="#+id/profileDriveStatue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="45dp"
android:gravity="left"
android:padding="5dp"
android:text=""
android:textColor="#color/text_display_color"
android:textSize="#dimen/profile_info_text_size" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layoutDirection="rtl"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/age"
android:textColor="#color/white"
android:textSize="#dimen/profile_text_size"
android:layout_gravity="center"
android:gravity="right"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/text_display_color"
android:layout_gravity="center"
android:gravity="left"
android:layout_marginRight="96dp"
android:textSize="#dimen/profile_info_text_size"
android:text=""
android:padding="5dp"
android:id="#+id/profileAge"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
and i displayed it inside my recycleView :
`<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:scrollbarStyle="outsideOverlay"
android:paddingBottom="28dp" />
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>`
i displayed this content by depend on viewHolder and it;s worked fine
but i can't scroll inside the recycleView..
how i can scroll inside it ?
is that possibole?
If remove NestedScrollView from your container.xml is no working , may be add it to your recyclerView layout , here is my project if i want to scroll inside the recyclerView:
<android.support.v4.widget.NestedScrollView
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.github.mikephil.charting.charts.LineChart
android:id="#+id/lineChartDiastolic"
android:layout_width="match_parent"
android:layout_height="250dp"></com.github.mikephil.charting.charts.LineChart>
<TextView
android:id="#+id/lineChartSystolicTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/systolic"
android:textColor="#android:color/black"
android:textSize="20dp" />
<com.github.mikephil.charting.charts.LineChart
android:id="#+id/lineChartSystolic"
android:layout_width="match_parent"
android:layout_height="250dp"></com.github.mikephil.charting.charts.LineChart>
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerForDataReportBloodPressure"
android:layout_width="match_parent"
android:layout_height="350dp"></android.support.v7.widget.RecyclerView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
In your case , remove NestedScrollView on container.xml , add it on recyclerView layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:scrollbarStyle="outsideOverlay"
android:paddingBottom="28dp" />
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
I developed an android application with reference to Nexus 7 in android studio preview which is 7" in size. The app is running with designed layout in some 7" tablets but not running with desired layouts in some other 7" tablets.
[![Display with layout being mixed up (iball Slide 7" tablet)][1]][1].
[![Dispay with proper layout(Micromax canvas P290 )][2]][2]
This is the xml code for layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="15dp"
android:focusableInTouchMode="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingRight="15dp"
android:paddingLeft="15dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_below="#+id/chek"
android:background="#drawable/border_around"
android:layout_marginTop="10dp"
android:id="#+id/patient">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/date"
android:textSize="16sp"
android:text="Date :"/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="#+id/dateTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/date"
android:text="2/11/2016"
android:layout_marginLeft="18dp"
/>
<View
android:layout_width="1dp"
android:layout_height="60dp"
android:background="#c0c0c0"
android:id="#+id/viewa"
android:layout_toRightOf="#+id/dateTxt"
android:layout_marginLeft="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/id"
android:textSize="16sp"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/viewa"
android:text="IP No :"/>
<TextView
android:layout_width="230dp"
android:layout_height="wrap_content"
android:id="#+id/idTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/id"
android:text="133245"
android:layout_marginLeft="20dp"
/>
<View
android:layout_width="1dp"
android:layout_height="60dp"
android:background="#c0c0c0"
android:id="#+id/viewb"
android:layout_toRightOf="#+id/idTxt"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/patientName"
android:layout_below="#id/date"
android:layout_marginTop="10dp"
android:text="Patient Name :"/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="#+id/patientNameTxt"
android:layout_below="#id/date"
android:textSize="16sp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/patientName"
android:text="Ravi Kumar"
android:layout_marginLeft="13dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/docName"
android:layout_below="#id/date"
android:layout_toRightOf="#+id/viewa"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:text="Primary Consultant :"/>
<TextView
android:layout_width="280dp"
android:layout_height="wrap_content"
android:id="#+id/docNameTxt"
android:textSize="16sp"
android:layout_below="#id/date"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/docName"
android:text="fddf"
android:layout_marginLeft="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/age"
android:textSize="16sp"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/viewb"
android:text="Age :"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/ageTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/age"
android:text="48"
android:layout_marginLeft="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/bednum"
android:textSize="16sp"
android:layout_below="#id/age"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/viewb"
android:text="Bed No :"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/bednumTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/bednum"
android:text="14"
android:layout_below="#id/age"
android:layout_marginTop="10dp"
android:layout_marginLeft="20dp"
/>
</RelativeLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#c0c0c0"
android:id="#+id/view1"
android:layout_below="#+id/patient"
android:layout_marginTop="20dp"/>
<ScrollView
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_below="#+id/view1"
android:layout_marginTop="30dp"
android:layout_marginBottom="10dp"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/line1"
android:layout_marginLeft="60dp"
>
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:src="#drawable/bed"
android:id="#+id/dailyassesment"
android:layout_toRightOf="#+id/nursingassessment"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Handover Checklist"
android:layout_marginTop="10dp"
android:textSize="17sp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="#+id/calender"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/line3"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/line1">
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:src="#drawable/nursingassesment"
android:id="#+id/nursingcare"
android:clickable="true"
android:layout_toRightOf="#+id/doctor"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nursing Care Plans"
android:layout_below="#+id/nursingassessment"
android:layout_marginTop="10dp"
android:textSize="17sp"
android:layout_marginLeft="25dp"
android:layout_toRightOf="#+id/calender"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/line4"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/line3">
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:src="#drawable/graph"
android:id="#+id/vitalsigns"
android:layout_toRightOf="#+id/nursingassessment"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Vital Signs Input"
android:layout_below="#+id/vitalsigns"
android:layout_marginTop="10dp"
android:textSize="17sp"
android:layout_marginLeft="35dp"
android:layout_toRightOf="#+id/calender"/>
</LinearLayout>
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="vertical"-->
<!--android:id="#+id/line3"-->
<!--android:layout_marginLeft="20dp"-->
<!--android:layout_toRightOf="#+id/line2">-->
<!--<ImageView-->
<!--android:layout_width="180dp"-->
<!--android:layout_height="wrap_content"-->
<!--android:src="#drawable/nursecare"-->
<!--android:id="#+id/nursingassessment"-->
<!--android:clickable="true"-->
<!--android:layout_toRightOf="#+id/doctor"-->
<!--/>-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="Nursing Initial Assesments"-->
<!--android:layout_below="#+id/nursingassessment"-->
<!--android:layout_marginTop="10dp"-->
<!--android:layout_toRightOf="#+id/calender"/>-->
<!--</LinearLayout>-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/line5"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/line4">
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:src="#drawable/doctor"
android:id="#+id/doctor"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Doctors Notes"
android:layout_below="#+id/doctor"
android:layout_marginTop="10dp"
android:textSize="17sp"
android:layout_marginLeft="40dp"
android:layout_toRightOf="#+id/calender"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/line6"
android:layout_marginTop="30dp"
android:layout_marginLeft="60dp"
android:layout_below="#+id/line4"
>
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:src="#drawable/bed"
android:id="#+id/dailyassesment1"
android:layout_toRightOf="#+id/nursingassessment"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ISBAR Checklist-GW"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:textSize="17sp"
android:layout_toRightOf="#+id/calender"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/line7"
android:layout_marginTop="30dp"
android:layout_toRightOf="#+id/line6"
android:layout_marginLeft="30dp"
android:layout_below="#+id/line4"
>
<ImageView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:src="#drawable/bed"
android:id="#+id/dailyassesment2"
android:layout_toRightOf="#+id/nursingassessment"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ISBAR-ICU"
android:layout_marginTop="10dp"
android:textSize="17sp"
android:layout_marginLeft="50dp"
android:layout_toRightOf="#+id/calender"/>
</LinearLayout>
</RelativeLayout>
</ScrollView>
Try this library for working with multiple screen resolutions it is easy to use and simply documented with sample code source
Here you go! scrollview will fit all sizes!! for the upper section you need to create seprated layout for different sizes! You can do it from the top menu in the designer page in android studio "create other variation" or manage it programmatically
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="15dp"
android:focusableInTouchMode="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingRight="15dp"
android:paddingLeft="15dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_below="#+id/chek"
android:background="#drawable/delete"
android:layout_marginTop="10dp"
android:id="#+id/patient">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/date"
android:textSize="16sp"
android:text="Date :"/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="#+id/dateTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/date"
android:text="2/11/2016"
android:layout_marginLeft="18dp"
/>
<View
android:layout_width="1dp"
android:layout_height="60dp"
android:background="#c0c0c0"
android:id="#+id/viewa"
android:layout_toRightOf="#+id/dateTxt"
android:layout_marginLeft="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/id"
android:textSize="16sp"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/viewa"
android:text="IP No :"/>
<TextView
android:layout_width="230dp"
android:layout_height="wrap_content"
android:id="#+id/idTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/id"
android:text="133245"
android:layout_marginLeft="20dp"
/>
<View
android:layout_width="1dp"
android:layout_height="60dp"
android:background="#c0c0c0"
android:id="#+id/viewb"
android:layout_toRightOf="#+id/idTxt"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/patientName"
android:layout_below="#id/date"
android:layout_marginTop="10dp"
android:text="Patient Name :"/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="#+id/patientNameTxt"
android:layout_below="#id/date"
android:textSize="16sp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/patientName"
android:text="Ravi Kumar"
android:layout_marginLeft="13dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/docName"
android:layout_below="#id/date"
android:layout_toRightOf="#+id/viewa"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:text="Primary Consultant :"/>
<TextView
android:layout_width="280dp"
android:layout_height="wrap_content"
android:id="#+id/docNameTxt"
android:textSize="16sp"
android:layout_below="#id/date"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/docName"
android:text="fddf"
android:layout_marginLeft="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/age"
android:textSize="16sp"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/viewb"
android:text="Age :"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/ageTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/age"
android:text="48"
android:layout_marginLeft="20dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/bednum"
android:textSize="16sp"
android:layout_below="#id/age"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/viewb"
android:text="Bed No :"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/bednumTxt"
android:textSize="16sp"
android:layout_toRightOf="#+id/bednum"
android:text="14"
android:layout_below="#id/age"
android:layout_marginTop="10dp"
android:layout_marginLeft="20dp"
/>
</RelativeLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#c0c0c0"
android:id="#+id/view1"
android:layout_below="#+id/patient"
android:layout_marginTop="20dp"/>
<ScrollView
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_below="#+id/view1"
android:layout_marginTop="30dp"
android:layout_marginBottom="10dp"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
>
<LinearLayout
android:id="#+id/firstRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/line1"
android:layout_weight="1"
android:layout_margin="5dp"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/delete"
android:id="#+id/dailyassesment"
android:layout_toRightOf="#+id/nursingassessment" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Handover Checklist"
android:layout_marginTop="10dp"
android:textSize="17sp"
android:layout_toRightOf="#+id/calender"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/line3"
android:layout_weight="1"
android:layout_margin="5dp"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/delete"
android:id="#+id/nursingcare"
android:clickable="true"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Nursing Care Plans"
android:textSize="17sp"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/line4"
android:layout_weight="1"
android:layout_margin="5dp"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/delete"
android:id="#+id/vitalsigns"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Vital Signs Input"
android:textSize="17sp"
android:gravity="center" />
</LinearLayout>
</LinearLayout>
<!--<LinearLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="vertical"-->
<!--android:id="#+id/line3"-->
<!--android:layout_marginLeft="20dp"-->
<!--android:layout_toRightOf="#+id/line2">-->
<!--<ImageView-->
<!--android:layout_width="180dp"-->
<!--android:layout_height="wrap_content"-->
<!--android:src="#drawable/nursecare"-->
<!--android:id="#+id/nursingassessment"-->
<!--android:clickable="true"-->
<!--android:layout_toRightOf="#+id/doctor"-->
<!--/>-->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="Nursing Initial Assesments"-->
<!--android:layout_below="#+id/nursingassessment"-->
<!--android:layout_marginTop="10dp"-->
<!--android:layout_toRightOf="#+id/calender"/>-->
<!--</LinearLayout>-->
<LinearLayout
android:id="#+id/secondRow"
android:layout_below="#id/firstRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/line5"
android:layout_weight="1"
android:layout_margin="5dp"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/delete"
android:id="#+id/doctor"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Doctors Notes"
android:layout_below="#+id/doctor"
android:layout_marginTop="10dp"
android:textSize="17sp"
android:layout_toRightOf="#+id/calender"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/line6"
android:layout_weight="1"
android:layout_margin="5dp"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/delete"
android:id="#+id/dailyassesment1"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ISBAR Checklist-GW"
android:textSize="17sp"
android:gravity="center" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/line7"
android:layout_weight="1"
android:layout_margin="5dp"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/delete"
android:id="#+id/dailyassesment2"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="ISBAR-ICU"
android:textSize="17sp"
android:gravity="center" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
Replace your scrollview with the following code
<ScrollView 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="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/line1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
>
<ImageView
android:id="#+id/dailyassesment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="Handover Checklist"
android:textSize="17sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/line3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="#+id/nursingcare"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="Nursing Care Plans"
android:textSize="17sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/line4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="#+id/vitalsigns"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="Vital Signs Input"
android:textSize="17sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/line5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="#+id/doctor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/doctor"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="Doctors Notes"
android:textSize="17sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/line6"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_below="#+id/line4"
android:layout_marginTop="30dp"
android:orientation="vertical"
>
<ImageView
android:id="#+id/dailyassesment1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="ISBAR Checklist-GW"
android:textSize="17sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/line7"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_below="#+id/line4"
android:layout_marginLeft="30dp"
android:layout_marginTop="30dp"
android:orientation="vertical">
<ImageView
android:id="#+id/dailyassesment2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="ISBAR-ICU"
android:textSize="17sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"></LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
Note: Replace your images... I am adding default launcher icons
How To manage imageviews and textview with theirs alignments ?
here is code i have tried.. i have used toolbar to achieve this but failed to achieve , can anyone tell me how to accomplish this ?
<android.support.v7.widget.Toolbar
android:background="#color/backcolor"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="8">
<TextView
android:layout_weight="2"
android:drawableTop="#drawable/a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Grid"
android:textSize="15sp"
android:textColor="#color/white"
android:textStyle="bold"
/>
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
out put i want
Try this code.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar 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="wrap_content"
android:layout_alignParentBottom="true"
android:background="?attr/fillColor"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/ic_launcher"
android:gravity="center"
android:text="Test"
android:textColor="?attr/fillColor"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="1dip"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:background="#000000" />
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="?attr/fillColor" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/ic_launcher"
android:gravity="center"
android:text="Test"
android:textColor="?attr/fillColor"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="1dip"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:background="#000000" />
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="?attr/fillColor" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/ic_launcher"
android:gravity="center"
android:text="Test"
android:textColor="?attr/fillColor"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="1dip"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:background="#000000" />
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="?attr/fillColor" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="2"
android:drawableTop="#drawable/ic_launcher"
android:gravity="center"
android:text="Test"
android:textColor="?attr/fillColor"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
Here is Screen Shot.
Try following layout:
<android.support.v7.widget.Toolbar
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="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/com_facebook_button_background_color"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/a"
android:gravity="center"
android:text="Grid"
android:textColor="#color/colorWhite"
android:textSize="15sp"
android:textStyle="bold"
/>
</LinearLayout>
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="#color/colorWhite"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/a"
android:gravity="center"
android:text="Grid"
android:textColor="#color/colorWhite"
android:textSize="15sp"
android:textStyle="bold"
/>
</LinearLayout>
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="#color/colorWhite"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/a"
android:gravity="center"
android:text="Grid"
android:textColor="#color/colorWhite"
android:textSize="15sp"
android:textStyle="bold"
/>
</LinearLayout>
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="#color/colorWhite"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="2"
android:drawableTop="#drawable/a"
android:gravity="center"
android:text="Grid"
android:textColor="#color/colorWhite"
android:textSize="15sp"
android:textStyle="bold"
/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
Try this way it works for me
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:Fnt_Awsm_Button="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/fbutton_color_whight"
android:orientation="vertical"
android:padding="#dimen/marging_pading_8pd">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="4"
android:background="#f0ff"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/batss"
android:layout_gravity="center_horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:text="Grid"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="50dp"
android:background="#ff00ff"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/batss"
android:layout_gravity="center_horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:text="Grid"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="50dp"
android:background="#ff00ff"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/batss"
android:layout_gravity="center_horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:text="Grid"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="50dp"
android:background="#ff00ff"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/batss"
android:layout_gravity="center_horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:text="Grid"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
use 4 textview only
[<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="#dimen/actvity1_padda" >
<TextView
android:id="#+id/main_comp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="#drawable/chat_secton8"
android:text="#string/comp" />
<TextView
android:id="#+id/main_learn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="#drawable/lean_businesstip"
android:text="#string/learn" />
<TextView
android:id="#+id/main_mydoc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="#drawable/chat_increase"
android:text="#string/mydoc" />
<TextView
android:id="#+id/main_business"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="#drawable/chat_secton8"
android:text="Business" />
</LinearLayout>][1]