I am trying to implement Toolbar in Activity but when i try to run app after implementing Toolbar with
DrawerLayout >> CoordinatorLayout >> AppBarLayout
Content not showing. Here is layout file.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scrollbars="none"
android:background="#FFECECEC"
tools:openDrawer="start">
<android.support.design.widget.CoordinatorLayout
android:background="#FFECECEC"
android:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
</FrameLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:id="#+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.05"
android:background="#drawable/header"
android:baselineAligned="false"
android:gravity="center" >
<TextView
android:id="#+id/tv"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center|left"
android:text="Timer : "
android:textColor="#color/White"
android:textSize="12dp" />
<TextView
android:id="#+id/txtquesnum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="1/10"
android:textColor="#color/White"
android:textSize="14dp" />
<ToggleButton
android:id="#+id/toggleButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#xml/togglecheck"
android:checked="false" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#drawable/seperator" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="4dp"
android:layout_weight="0.2"
android:orientation="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="#+id/taque"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_marginTop="3dp"
android:gravity="center|left"
android:text="Question"
android:textColor="#color/Black"
android:textSize="16dp"
android:typeface="normal" />
<com.applidium.shutterbug.FetchableImageView
android:id="#+id/imageView1"
android:layout_width="120dp"
android:layout_height="120dp"
android:src="#drawable/splash_icon" />
</LinearLayout>
</ScrollView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:layout_weight="0.3"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:baselineAligned="false"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:layout_weight="1"
android:background="#drawable/normal"
android:baselineAligned="false"
android:gravity="center" >
<TextView
android:id="#+id/taOpt5"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_span="0"
android:gravity="center|left"
android:hint="Option 1"
android:padding="2dp"
android:singleLine="false"
android:textColor="#color/Black"
android:textSize="17dp"
android:typeface="serif"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:layout_weight="1"
android:background="#drawable/normal"
android:baselineAligned="false"
android:gravity="center" >
<TextView
android:id="#+id/taOpt6"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center|left"
android:hint="Option 2"
android:padding="2dp"
android:shadowColor="#color/black"
android:singleLine="false"
android:textColor="#color/Black"
android:textSize="17dp"
android:typeface="serif"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:layout_weight="1"
android:background="#drawable/normal"
android:gravity="center" >
<TextView
android:id="#+id/taOpt7"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center|left"
android:hint="Option 3"
android:inputType="none"
android:padding="2dp"
android:shadowColor="#color/black"
android:singleLine="false"
android:textColor="#color/Black"
android:textSize="17dp"
android:typeface="serif"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:layout_weight="1"
android:background="#drawable/normal"
android:gravity="center" >
<TextView
android:id="#+id/taOpt8"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center|left"
android:hint="Option 4"
android:inputType="none"
android:padding="2dp"
android:shadowColor="#color/black"
android:singleLine="false"
android:textColor="#color/Black"
android:textSize="17dp"
android:typeface="serif"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
</android.support.v4.widget.DrawerLayout>
But when I move content inside AppBarLayout so everything is visible but inside appbar. how to fix this issue? Any idea.
While using Cordinator layout your layout should look like this
<CoordinatorLayout>
<AppBarLayout>
//Toolbar and other contents should come here
</AppBarLayout>
<Recycler Or Nested Scroll View>
<LinearLayout
app:layout_behavior="#string/appbar_scrolling_view_behavior">
//This is used when you have a collapsing toolbar and you need to add a scrolling behaviour for your views.
<LinearLayout/>
<Recycler Or Nested Scroll View/>
Instead try this layout.
<android.support.design.widget.CoordinatorLayout
android:background="#FFECECEC"
android:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
</FrameLayout>
<LinearLayout
android:id="#+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="#drawable/header"
android:orientation="vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:baselineAligned="false"
android:gravity="center" >
<TextView
android:id="#+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|left"
android:text="Timer : "
android:textColor="#color/White"
android:textSize="12dp" />
<TextView
android:id="#+id/txtquesnum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="1/10"
android:textColor="#color/White"
android:textSize="14dp" />
<ToggleButton
android:id="#+id/toggleButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#xml/togglecheck"
android:checked="false" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#drawable/seperator" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="4dp"
android:layout_weight="0.2"
android:orientation="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="#+id/taque"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_marginTop="3dp"
android:gravity="center|left"
android:text="Question"
android:textColor="#color/Black"
android:textSize="16dp"
android:typeface="normal" />
<com.applidium.shutterbug.FetchableImageView
android:id="#+id/imageView1"
android:layout_width="120dp"
android:layout_height="120dp"
android:src="#drawable/splash_icon" />
</LinearLayout>
</ScrollView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:layout_weight="0.3"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:baselineAligned="false"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:layout_weight="1"
android:background="#drawable/normal"
android:baselineAligned="false"
android:gravity="center" >
<TextView
android:id="#+id/taOpt5"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_span="0"
android:gravity="center|left"
android:hint="Option 1"
android:padding="2dp"
android:singleLine="false"
android:textColor="#color/Black"
android:textSize="17dp"
android:typeface="serif"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:layout_weight="1"
android:background="#drawable/normal"
android:baselineAligned="false"
android:gravity="center" >
<TextView
android:id="#+id/taOpt6"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center|left"
android:hint="Option 2"
android:padding="2dp"
android:shadowColor="#color/black"
android:singleLine="false"
android:textColor="#color/Black"
android:textSize="17dp"
android:typeface="serif"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:layout_weight="1"
android:background="#drawable/normal"
android:gravity="center" >
<TextView
android:id="#+id/taOpt7"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center|left"
android:hint="Option 3"
android:inputType="none"
android:padding="2dp"
android:shadowColor="#color/black"
android:singleLine="false"
android:textColor="#color/Black"
android:textSize="17dp"
android:typeface="serif"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:layout_weight="1"
android:background="#drawable/normal"
android:gravity="center" >
<TextView
android:id="#+id/taOpt8"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center|left"
android:hint="Option 4"
android:inputType="none"
android:padding="2dp"
android:shadowColor="#color/black"
android:singleLine="false"
android:textColor="#color/Black"
android:textSize="17dp"
android:typeface="serif"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
Your linear_layout height is fixed at 0 and hence not expandable. use wrap_content or match_parent.
Change
<LinearLayout
android:id="#+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.05"
android:background="#drawable/header"
android:baselineAligned="false"
android:gravity="center" >
to
<LinearLayout
android:id="#+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="0.05"
android:background="#drawable/header"
android:baselineAligned="false"
android:gravity="center" >
Just change the height android:layout_height="match_parent"
All code .
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFECECEC"
android:fitsSystemWindows="true"
android:scrollbars="none"
tools:openDrawer="start">
<android.support.design.widget.CoordinatorLayout
android:id="#+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFECECEC">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"/>
</FrameLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:id="#+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="0.05"
android:background="#drawable/header"
android:baselineAligned="false"
android:gravity="center">
<TextView
android:id="#+id/tv"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center|left"
android:text="Timer : "
android:textColor="#color/White"
android:textSize="12dp"/>
<TextView
android:id="#+id/txtquesnum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="1/10"
android:textColor="#color/White"
android:textSize="14dp"/>
<ToggleButton
android:id="#+id/toggleButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#xml/togglecheck"
android:checked="false"/>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#drawable/seperator"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_weight="0.2"
android:orientation="vertical">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/taque"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_marginTop="3dp"
android:gravity="center|left"
android:text="Question"
android:textColor="#color/Black"
android:textSize="16dp"
android:typeface="normal"/>
<com.applidium.shutterbug.FetchableImageView
android:id="#+id/imageView1"
android:layout_width="120dp"
android:layout_height="120dp"
android:src="#drawable/splash_icon"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_margin="2dp"
android:layout_weight="0.3"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:baselineAligned="false"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:layout_weight="1"
android:background="#drawable/normal"
android:baselineAligned="false"
android:gravity="center">
<TextView
android:id="#+id/taOpt5"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_span="0"
android:gravity="center|left"
android:hint="Option 1"
android:padding="2dp"
android:singleLine="false"
android:textColor="#color/Black"
android:textSize="17dp"
android:typeface="serif"
android:visibility="visible"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:layout_weight="1"
android:background="#drawable/normal"
android:baselineAligned="false"
android:gravity="center">
<TextView
android:id="#+id/taOpt6"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center|left"
android:hint="Option 2"
android:padding="2dp"
android:shadowColor="#color/black"
android:singleLine="false"
android:textColor="#color/Black"
android:textSize="17dp"
android:typeface="serif"
android:visibility="visible"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:layout_weight="1"
android:background="#drawable/normal"
android:gravity="center">
<TextView
android:id="#+id/taOpt7"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center|left"
android:hint="Option 3"
android:inputType="none"
android:padding="2dp"
android:shadowColor="#color/black"
android:singleLine="false"
android:textColor="#color/Black"
android:textSize="17dp"
android:typeface="serif"
android:visibility="visible"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="2dp"
android:layout_weight="1"
android:background="#drawable/normal"
android:gravity="center">
<TextView
android:id="#+id/taOpt8"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="center|left"
android:hint="Option 4"
android:inputType="none"
android:padding="2dp"
android:shadowColor="#color/black"
android:singleLine="false"
android:textColor="#color/Black"
android:textSize="17dp"
android:typeface="serif"
android:visibility="visible"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
</android.support.v4.widget.DrawerLayout>
Sometimes Coordinate Layout don't work with API version 25 or less if you are Using these for Application change it Other like Frame,Linear or Relative....
Layout also have Time Complexity i.e for Frame O(1), Linear (n), Relative O(n2)
Related
I am trying to create layout like below in android:
But my problem is I am unable to add textbelow the image or on the right hand side of imageview. If I wrap ImageView and textview in a LinearLayout the then the whole view shrinks. Should I be using TableLayout?
My current layout xml is like below:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_below="#id/my_recycler_view"
android:layout_margin="30dp">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="300dp"
android:orientation="vertical"
android:layout_weight="1"
>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/vwImageAndClassroom"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
>
<ImageView
android:id="#+id/img_room"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:contentDescription="#string/coverimage_contentdescription"
android:scaleType="fitCenter"
android:src="#drawable/comm_book_icon"
/>
<TextView
android:id="#+id/tv_emp_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:textSize="12dp"
android:textStyle="bold"
android:textAllCaps="true"
android:layout_below="#id/img_room"
android:layout_marginBottom="20dp"
android:gravity="center_horizontal"
android:text="TEXT 1"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="300dp"
android:orientation="vertical"
android:layout_weight="1"
>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/vwImageAndClassroom2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
>
<ImageView
android:id="#+id/img_room2"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:contentDescription="#string/coverimage_contentdescription"
android:scaleType="fitCenter"
android:src="#drawable/visitor_book_icon"
/>
<TextView
android:id="#+id/tv_emp_name2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:textSize="12dp"
android:textStyle="bold"
android:textAllCaps="true"
android:layout_below="#id/img_room2"
android:layout_marginBottom="20dp"
android:gravity="center_horizontal"
android:text="TEXT 2"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="300dp"
android:orientation="vertical"
android:layout_weight="1"
>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/vwImageAndClassroom3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
>
<ImageView
android:id="#+id/img_room3"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:contentDescription="#string/coverimage_contentdescription"
android:scaleType="fitCenter"
android:src="#drawable/visitor_book_icon"
/>
<TextView
android:id="#+id/tv_emp_name3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:textSize="12dp"
android:textStyle="bold"
android:textAllCaps="true"
android:layout_below="#id/img_room3"
android:layout_marginBottom="20dp"
android:gravity="center_horizontal"
android:text="TEXT 3"
/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
Hope this will help you and you will find your solutions from this xml code. I just modify some of your code
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="#+id/image1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:src="#android:drawable/ic_search_category_default"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This Right side text 1"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:src="#android:drawable/ic_search_category_default"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This Right side text 1"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:src="#android:drawable/ic_search_category_default"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This Right side text 1"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="This is under layout text"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="This is under layout text"/>
</LinearLayout>
</LinearLayout>
Have placeholder views where text is not required.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#color/next_green" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#color/next_green" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#color/next_green" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="text"/>
</LinearLayout>
</LinearLayout>
I did exactly what you want
Open image
<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="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="#android:drawable/btn_dialog" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView3"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="#android:drawable/btn_dialog" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="#android:drawable/btn_dialog" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/textView5"
android:layout_width="match_parent"
android:layout_height="15dp"
android:text="Some text" />
<TextView
android:id="#+id/textView6"
android:layout_width="match_parent"
android:layout_height="15dp"
android:text="Some text" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="#+id/textView7"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Some text"
app:srcCompat="#android:drawable/btn_dialog" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="#+id/textView8"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Some text"
app:srcCompat="#android:drawable/btn_dialog" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="#+id/textView9"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Some text"
app:srcCompat="#android:drawable/btn_dialog" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
I have a little bit issue here.
layout which i have been designed in photoshop looks like below
and the layout which i design in xml look like below:
So, you see that for some reason, the edittexts look very off.here is the full XML code:
<?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:background="#1fed7b">
<LinearLayout
android:orientation="vertical"
android:gravity="center"
android:layout_weight="114"
android:layout_width="match_parent"
android:layout_height="0dp">
<ImageButton
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/txt_headline" />
</LinearLayout>
<LinearLayout
android:gravity="top"
android:orientation="horizontal"
android:layout_weight="281"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="44"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="top"
android:orientation="vertical"
android:layout_weight="547"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/txt_subline1" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="44"
android:layout_width="0dp"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="20"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="10"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="10"
android:layout_width="0dp"
android:layout_height="wrap_content">
<EditText
android:id="#+id/txt_hours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
android:gravity="center"
android:hint="00"
android:inputType="number"
android:maxLength="2"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="55sp" />
<TextView
android:text=":"
android:layout_gravity="top"
android:gravity="center_vertical"
android:id="#+id/txt_colon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="55sp" />
<EditText
android:id="#+id/txt_minutes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
android:gravity="center_vertical"
android:hint="00"
android:inputType="number"
android:maxLength="2"
android:singleLine="true"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="55sp" />
<LinearLayout
android:gravity="left"
android:orientation="horizontal"
android:layout_weight="10"
android:layout_width="0dp"
android:layout_height="match_parent">
<TextView
android:text="00"
android:layout_gravity="left"
android:gravity="bottom"
android:id="#+id/txt_seconds"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="189"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="160"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="top"
android:orientation="vertical"
android:layout_weight="140"
android:layout_width="0dp"
android:layout_height="match_parent">
<TextView
android:text="hh"
android:layout_gravity="left"
android:gravity="top"
android:id="#+id/txt_hh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="110"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="top"
android:orientation="vertical"
android:layout_weight="140"
android:layout_width="0dp"
android:layout_height="match_parent">
<TextView
android:text="mm"
android:layout_gravity="right"
android:gravity="top"
android:id="#+id/txt_mm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="160"
android:layout_width="0dp"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="250"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="314"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_playstore"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_playstore" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="5"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_random"
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_random" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="15"
android:layout_width="match_parent"
android:layout_height="0dp" />
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="314"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_facebook"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_fb" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="5"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_start"
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_start" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="209"
android:layout_width="match_parent"
android:layout_height="0dp">
<ImageButton
android:id="#+id/btn_skip"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_skip" />
</LinearLayout>
</LinearLayout>
I know, it is a lot of code, but I really need your help here. Can you do me a favor and look through it? That be so awesome!!!
Thank you!
here is solution for your problem,copy and past code.
<?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:background="#1fed7b">
<LinearLayout
android:orientation="vertical"
android:gravity="center"
android:layout_weight="114"
android:layout_width="match_parent"
android:layout_height="0dp">
<ImageButton
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/txt_headline" />
</LinearLayout>
<LinearLayout
android:gravity="top"
android:orientation="horizontal"
android:layout_weight="281"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="44"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="top"
android:orientation="vertical"
android:layout_weight="547"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/txt_subline1" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="44"
android:layout_width="0dp"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="20"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="90dp"
android:layout_height="match_parent"
android:orientation="vertical"></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/txt_hours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
android:hint="00"
android:inputType="number"
android:maxLength="2"
android:layout_weight="1"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="55sp" />
<TextView
android:id="#+id/txt_colon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="top"
android:gravity="center"
android:text=":"
android:layout_weight="2"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="55sp" />
<EditText
android:id="#+id/txt_minutes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
android:layout_weight="1"
android:hint="00"
android:gravity="right"
android:inputType="number"
android:maxLength="2"
android:singleLine="true"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="55sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top"
android:orientation="horizontal">
<TextView
android:id="#+id/txt_mm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:text="mm"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="20sp" />
<TextView
android:id="#+id/txt_hh"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="right"
android:text="hh"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="90dp"
android:layout_height="match_parent"
>
<TextView
android:id="#+id/txt_seconds"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="00"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="250"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="314"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_playstore"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_playstore" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="5"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_random"
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_random" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="15"
android:layout_width="match_parent"
android:layout_height="0dp" />
<LinearLayout
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="314"
android:layout_width="match_parent"
android:layout_height="0dp">
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_facebook"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_fb" />
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="5"
android:layout_width="0dp"
android:layout_height="match_parent" />
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="314"
android:layout_width="0dp"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_start"
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_start" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:gravity="center"
android:orientation="vertical"
android:layout_weight="209"
android:layout_width="match_parent"
android:layout_height="0dp">
<ImageButton
android:id="#+id/btn_skip"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/btn_skip" />
</LinearLayout>
</LinearLayout>
hope this will solve your problem
Here is my xml file:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="#dimen/small_margin"
android:layout_marginRight="#dimen/small_margin"
android:background="#android:color/transparent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
android:background="#android:color/transparent"
android:id="#+id/nested_scrollview"
>
<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">
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="#dimen/medium_margin"
android:background="#drawable/button_layout_progress_fragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="#dimen/medium_margin"
android:layout_marginRight="#dimen/small_margin"
android:layout_marginLeft="#dimen/small_margin"
android:layout_marginBottom="#dimen/small_margin">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:textAppearanceMedium"
android:text="Time spent:"
android:textStyle="bold"
android:textColor="#android:color/black"
android:layout_marginRight="#dimen/small_margin"/>
<TextView
android:textColor="#android:color/black"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:textAppearanceMedium"
android:text="2hrs 37 mins" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginRight="#dimen/small_margin"
android:layout_marginLeft="#dimen/small_margin"
android:layout_marginBottom="#dimen/small_margin"
>
<TextView
android:textColor="#android:color/black"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:textAppearanceMedium"
android:text="New words learnt:"
android:textStyle="bold"
android:layout_marginRight="#dimen/small_margin"/>
<TextView
android:textColor="#android:color/black"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:textAppearanceMedium"
android:text="259 words"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginRight="#dimen/small_margin"
android:layout_marginLeft="#dimen/small_margin"
android:layout_marginBottom="#dimen/medium_margin"
>
<TextView
android:textColor="#android:color/black"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:textAppearanceMedium"
android:text="Word roots learnt:"
android:textStyle="bold"
android:layout_marginRight="#dimen/small_margin"/>
<TextView
android:textColor="#android:color/black"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:textAppearanceMedium"
android:text="37 words"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#drawable/button_layout_progress_fragment"
>
<GridView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="200dp"
android:layout_width="match_parent"
android:id="#+id/gvBadges"
android:numColumns="3"
android:horizontalSpacing="10dp"
android:verticalSpacing="10dp"
android:gravity="center"
android:stretchMode="columnWidth"
>
</GridView>
</LinearLayout>
</LinearLayout>
</ScrollView>
I use a scrollview cover gridview inside. And I want to use ONLY scrollview to scroll down the screen, so gridview will show all item inside it.
How can I make that? Thank u in advance!
use
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
instead of
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
android:background="#android:color/transparent"
android:id="#+id/nested_scrollview">
Scrollview in nestedScrollview is working fine with other versions of android but in kitkat it is not working.
I have addded onItemClick() function to nestedscrollview. while clicking on nested scrollview only scrollview(parent) working.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:padding="10dp"
>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/parentScrollview"
android:nestedScrollingEnabled="true"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/relative1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/navyBlue"
android:orientation="horizontal">
<ImageView
android:id="#+id/remarksLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/header_left_padding_size"
android:src="#drawable/ic_action_remarks_report_white"/>
<TextView
android:id="#+id/remarksTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#id/remarksLogo"
android:textColor="#color/white"
android:layout_marginRight="10dp"
android:gravity="center"
android:textSize="#dimen/header_text_size"
android:text=""
android:textStyle="bold"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="0dp"
android:paddingTop="10dp"
android:weightSum="6">
<TextView
android:id="#+id/datedTitles"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.5"
android:textAlignment="center"
android:padding="5dp"
android:background="#color/navyBlue"
android:textColor="#color/white"
android:paddingLeft="5dp"
android:textSize="#dimen/sub_header_text_size"
android:text=""/>
<TextView
android:id="#+id/fromTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.5"
android:padding="5dp"
android:background="#drawable/left_right_border_white"
android:textColor="#color/white"
android:paddingLeft="5dp"
android:textSize="#dimen/sub_header_text_size"
android:text=""/>
<TextView
android:id="#+id/detailsTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:padding="5dp"
android:background="#color/navyBlue"
android:textColor="#color/white"
android:paddingLeft="5dp"
android:textSize="#dimen/sub_header_text_size"
android:text=""/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="180dp"
android:orientation="vertical"
android:layout_marginBottom="20dp">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="true"
android:id="#+id/childNestedScrollView"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbars="vertical"
android:fadeScrollbars="false"
android:nestedScrollingEnabled="true"
android:fillViewport="true">
<com.iflytechsoft.studentsuccess.utils.studentsuccessutils.ListViewForEmbeddingInScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/remarksListView"
android:choiceMode="singleChoice"
android:background="#drawable/background_white_border_navyblue"
android:layout_marginBottom="20dp"
/>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="0dp"
android:id="#+id/announcementDetailLayout"
android:visibility="gone"
android:background="#color/navyBlue"
android:weightSum="6">
<TextView
android:id="#+id/dated"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:gravity="center"
android:background="#color/navyBlue"
android:textColor="#color/white"
android:paddingLeft="5dp"
android:textSize="#dimen/sub_header_text_size"
android:text=""/>
<TextView
android:id="#+id/from"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#drawable/left_right_border_white"
android:textColor="#color/white"
android:paddingLeft="5dp"
android:textSize="#dimen/sub_header_text_size"
android:text=""/>
<TextView
android:id="#+id/subject"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3.7"
android:background="#color/navyBlue"
android:textColor="#color/white"
android:paddingLeft="5dp"
android:textSize="#dimen/sub_header_text_size"
android:text=""/>
</LinearLayout>
<ir.noghteh.JustifiedTextView xmlns:noghteh="http://noghteh.ir"
android:id="#+id/details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:paddingLeft="5dp"
noghteh:textSize="#dimen/sub_header_text_size"
android:background="#drawable/background_white_border_navyblue"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>
I am using some static data inside NestedScrollView when i scroll the image will be collapsing its working fine. But when the screen size is big all my data is fitted into the screen that time i want to disable my scroll. how to do that.
My code
<android.support.design.widget.CoordinatorLayout
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.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="250dp"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
app:layout_collapseMode="parallax"
android:scaleType="centerCrop"
android:layout_height="match_parent" />
<RelativeLayout
android:layout_width="fill_parent"
android:background="#DD000000"
app:layout_collapseMode="parallax"
android:layout_height="fill_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Cafe Noir"
android:layout_gravity="center|left"
android:textAlignment="center"
android:id="#+id/textView34"
android:layout_marginLeft="20dp"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="119, 2nd Cross Rd, Phase 4, J P Nagar"
android:textColor="#color/colorsplashDark"
android:layout_gravity="center|left"
android:textAlignment="center"
android:id="#+id/textView35"
android:layout_below="#+id/textView34"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
app:behavior_overlapTop="64dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="24dp">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight=".3"
android:orientation="vertical">
<ImageView
android:id="#+id/imageView13"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:src="#drawable/checkin_history_time" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight=".1"
android:orientation="vertical">
<TextView
android:id="#+id/placename"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/checkin_history_time"
android:textColor="#android:color/black"
android:textSize="13dp"
android:textStyle="bold" />
<TextView
android:id="#+id/address"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:tag="Hover"
android:text="2 hours ago\n (3:15 pm)"
android:textColor="#color/colorSubText"
android:textSize="10dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight=".3"
android:orientation="vertical">
<ImageView
android:id="#+id/pointsimage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:src="#drawable/home_bounty_icon" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight=".1"
android:orientation="vertical">
<TextView
android:id="#+id/pointstitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/checkin_history_points"
android:textColor="#android:color/black"
android:textSize="13dp"
android:textStyle="bold" />
<TextView
android:id="#+id/pointsdesc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:tag="Hover"
android:text="You earned 10 Points for checkin"
android:textColor="#color/colorSubText"
android:textSize="10dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/billimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:padding="10dp"
android:src="#drawable/verify_places_snap_sample" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:drawableLeft="#drawable/checkin_history_uploadbill"
android:drawablePadding="10dp"
android:gravity="center"
android:visibility="gone"
android:layout_gravity="center"
android:text="#string/checkin_history_uploadphoto_warning"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_home_yourtotal_rewards"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight=".3"
android:orientation="vertical">
<ImageView
android:id="#+id/verificationimage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:src="#drawable/checkin_history_verify" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight=".1"
android:orientation="vertical">
<TextView
android:id="#+id/verifytitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/checkin_history_verification"
android:textColor="#android:color/black"
android:textSize="13dp"
android:textStyle="bold" />
<TextView
android:id="#+id/verifydesc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:tag="Hover"
android:text="Payment SMS verification Successful"
android:textColor="#color/colorSubText"
android:textSize="10dp"
android:textStyle="bold" />
<TextView
android:id="#+id/smstext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:tag="Hover"
android:text="Rs 100 was spent XXXXXXXXXXXXXXXXXXX on 2015-08-27"
android:textColor="#color/capturebill"
android:textSize="10dp"
android:textStyle="italic" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>