I'm using fragments to recreate a design, so basically my design consists of four buttons which are present in a Relative Layout and the remaining empty space of the activity is used as a fragment.
So everything works fine until the content in the fragment goes beyond the screen and it is not visible anymore. So I want to implement a ScrollView, so the user can scroll to see all the content, but unfortunately that doesn't work. I have been looking for solution all day but nothing helped.
Here is the image for reference.
Every suggestion is appreciated! Thank you.
Here is the code;
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".Fragment_1">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/text_1_frame_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginEnd="10dp"
android:fontFamily="#font/alata"
android:textStyle="bold"
android:text="#string/fragment_1_text_1"
android:textColor="#color/Deloitte"
android:textSize="32sp" />
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="#id/text_1_frame_1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/rl1_frame_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:background="#drawable/frame_design">
<TextView
android:id="#+id/education_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/open_sans"
android:padding="10dp"
android:text="#string/bachelors_in_engineering_cse"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:fontFamily="#font/open_sans"
android:layout_below="#id/education_1"
android:text="#string/neil_gogte_institute_of_technology_n_2020_2023"
android:textColor="#color/white"
android:textStyle="italic"
android:textSize="16sp"
android:paddingBottom="10dp"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl1_frame_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/rl1_frame_1"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:background="#drawable/frame_design">
<TextView
android:id="#+id/education_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/open_sans"
android:padding="10dp"
android:text="#string/diploma_in_computer_science"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:fontFamily="#font/open_sans"
android:layout_below="#id/education_2"
android:text="#string/government_institute_of_electronics_n_2016_2019"
android:textColor="#color/white"
android:textStyle="italic"
android:textSize="16sp"
android:paddingBottom="10dp"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl1_frame_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/rl1_frame_2"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:background="#drawable/frame_design">
<TextView
android:id="#+id/education_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/open_sans"
android:padding="10dp"
android:text="#string/ts_ssc"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:fontFamily="#font/open_sans"
android:layout_below="#id/education_3"
android:text="#string/bhashyam_high_school_n_2015_2016"
android:textColor="#color/white"
android:textStyle="italic"
android:textSize="16sp"
android:paddingBottom="10dp"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/certification_rl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_below="#id/rl1_frame_3"
android:background="#drawable/frame_design">
<ImageView
android:id="#+id/certification"
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:layout_height="wrap_content"
android:contentDescription="#string/certificate_icon"
android:layout_centerHorizontal="true"
android:src="#drawable/certification" />
<TextView
android:id="#+id/certification_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/certification"
android:layout_centerHorizontal="true"
android:fontFamily="#font/open_sans"
android:padding="10dp"
android:text="#string/android_basics_nanodegree_by_google"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/certification_1"
android:fontFamily="#font/open_sans"
android:paddingBottom="10dp"
android:layout_centerHorizontal="true"
android:text="Certified on July,2019 "
android:textColor="#color/white"
android:textSize="16sp"
android:textStyle="italic"
tools:ignore="HardcodedText" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/certification_rl_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_below="#id/rl1_frame_3"
android:background="#drawable/frame_design">
<ImageView
android:id="#+id/certification_img"
android:layout_width="match_parent"
android:layout_marginTop="10dp"
android:layout_height="wrap_content"
android:contentDescription="#string/certificate_icon"
android:layout_centerHorizontal="true"
android:src="#drawable/certification" />
<TextView
android:id="#+id/certification_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/certification_img"
android:layout_centerHorizontal="true"
android:fontFamily="#font/open_sans"
android:padding="10dp"
android:text="#string/android_basics_nanodegree_by_google"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/certification_2"
android:fontFamily="#font/open_sans"
android:paddingBottom="10dp"
android:layout_centerHorizontal="true"
android:text="Certified on July,2019 "
android:textColor="#color/white"
android:textSize="16sp"
android:textStyle="italic"
tools:ignore="HardcodedText" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
Here is main activity for the fragments!
<androidx.constraintlayout.widget.ConstraintLayout 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"
tools:context=".More_Info">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:orientation="horizontal"
android:layout_marginTop="15dp"
android:id="#+id/more_cv_ll">
<RelativeLayout
android:layout_weight="1"
android:id="#+id/rl_1"
android:layout_marginTop="15dp"
android:layout_marginStart="15dp"
android:layout_width="100dp"
android:layout_marginBottom="15dp"
android:background="#drawable/bg_buttons"
android:layout_height="100dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/education"
android:layout_centerInParent="true"/>
</RelativeLayout>
<RelativeLayout
android:layout_weight="1"
android:id="#+id/rl_2"
android:layout_marginStart="15dp"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:background="#drawable/bg_buttons"
android:layout_marginBottom="15dp"
android:layout_toRightOf="#id/rl_1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/skills" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_3"
android:layout_weight="1"
android:layout_marginStart="15dp"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:background="#drawable/bg_buttons"
android:layout_toRightOf="#id/rl_2">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/work_exp"
android:layout_centerInParent="true"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_4"
android:layout_weight="1"
android:layout_marginEnd="15dp"
android:layout_marginStart="15dp"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginBottom="15dp"
android:background="#drawable/bg_buttons"
android:layout_marginTop="15dp"
android:layout_toRightOf="#id/rl_3">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/contact"
android:layout_centerInParent="true"/>
</RelativeLayout>
</LinearLayout>
<FrameLayout
android:id="#+id/cv_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginTop="15dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/more_cv_ll" />
</androidx.constraintlayout.widget.ConstraintLayout>
ScrollView must have only 1 child. Currently you have a Linear and a Relative Layout inside it. Make sure to have only 1 layout group inside scrollview eg LinearLayout and then add your views to that LinearLayout
Related
lists.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/fix_container"
>
<TableLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:shrinkColumns="*"
android:stretchColumns="*">
<TableRow>
<TextView
android:id="#+id/tv1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:textSize="12sp"
android:textStyle="bold"
android:textColor="#color/black"/>
<TextView
android:id="#+id/tv2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="12sp"
android:textColor="#color/black"
android:layout_toRightOf="#id/tv1"
android:layout_marginTop="4dp"
android:textStyle="bold"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv1"
android:layout_marginStart="10dp" />
<TextView
android:id="#+id/tv3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12sp"
android:layout_toRightOf="#id/tv2"
android:layout_marginTop="4dp"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv2"
android:layout_marginStart="10dp" />
<TextView
android:id="#+id/tv4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12sp"
android:layout_toRightOf="#id/tv3"
android:layout_marginTop="4dp"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv3"
android:layout_marginStart="10dp" />
<TextView
android:id="#+id/tv5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12sp"
android:layout_toRightOf="#id/tv4"
android:layout_marginTop="4dp"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv4"
android:layout_marginStart="10dp" />
<TextView
android:id="#+id/tv6"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12sp"
android:layout_toRightOf="#id/tv5"
android:layout_marginTop="4dp"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv5"
android:layout_marginStart="10dp" />
<TextView
android:id="#+id/tv7"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12sp"
android:layout_toRightOf="#id/tv6"
android:layout_marginTop="4dp"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv6"
android:layout_marginStart="10dp" />
<TextView
android:id="#+id/tv8"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12sp"
android:layout_toRightOf="#id/tv7"
android:layout_marginTop="4dp"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv7"
android:layout_marginStart="10dp" />
<TextView
android:id="#+id/tv9"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12sp"
android:layout_toRightOf="#id/tv8"
android:layout_marginTop="4dp"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv8"
android:layout_marginStart="10dp" />
<TextView
android:id="#+id/tv10"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12sp"
android:layout_toRightOf="#id/tv9"
android:layout_marginTop="4dp"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv9"
android:layout_marginStart="10dp" />
<TextView
android:id="#+id/tv11"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12sp"
android:layout_toRightOf="#id/tv10"
android:layout_marginTop="4dp"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv10"
android:layout_marginStart="10dp" />
<TextView
android:id="#+id/tv12"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12sp"
android:layout_toRightOf="#id/tv11"
android:layout_marginTop="4dp"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv11"
android:layout_marginStart="10dp" />
<TextView
android:id="#+id/tv13"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12sp"
android:layout_toRightOf="#id/tv12"
android:layout_marginTop="4dp"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv12"
android:layout_marginStart="10dp" />
<TextView
android:id="#+id/tv14"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12sp"
android:layout_toRightOf="#id/tv13"
android:layout_marginTop="4dp"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv13"
android:layout_marginStart="10dp" />
<TextView
android:id="#+id/tv15"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12sp"
android:layout_toRightOf="#id/tv14"
android:layout_marginTop="4dp"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv14"
android:layout_marginStart="10dp" />
<TextView
android:id="#+id/tv16"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12sp"
android:layout_toRightOf="#id/tv15"
android:layout_marginTop="4dp"
android:layout_marginLeft="10dp"
android:layout_toEndOf="#id/tv15"
android:layout_marginStart="10dp" />
</TableRow>
</TableLayout>
</RelativeLayout>
I have written listview like this
<ListView
android:id="#+id/product_list_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:dividerHeight="3dp"
android:layout_marginTop="10dp"
android:layout_below="#+id/card_view_dispatch"/>
I set the lists.xml in my CustomListAdapter.java
I have total 16 textviews in horizontal.
vertical scrolling is coming but horizontal scrolling is not coming.
So How to keep horizontal scrollview to display data properly in phone also. How can I do this.
If this is not the correct way. Please suggest me another way.
Please help me.
Any help would be appreciated.
You can try out this library this
Basically the concept for this is simple, you need to create a vertical recyclerview and then add a horizontal recyclerview in the required positions.
I prefer Recyclerview over Listviews, its easy and memory efficient
Try this type of layout :
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView 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"
tools:context="com.e2logy.demoapplication.DemoActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="#color/colorAccent"/>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:nestedScrollingEnabled="false"
tools:layoutManager="android.support.v7.widget.LinearLayoutManager"
tools:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:listitem="#layout/tmp2"/>
</HorizontalScrollView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
My item file :
<?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"
android:orientation="horizontal">
<LinearLayout
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginRight="10dp"
tools:background="#tools:sample/avatars" />
<LinearLayout
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginRight="10dp"
tools:background="#tools:sample/avatars" />
<LinearLayout
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginRight="10dp"
tools:background="#tools:sample/avatars" />
<LinearLayout
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginRight="10dp"
tools:background="#tools:sample/avatars" />
<LinearLayout
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginRight="10dp"
tools:background="#tools:sample/avatars" />
<LinearLayout
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginRight="10dp"
tools:background="#tools:sample/avatars" />
<LinearLayout
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginRight="10dp"
tools:background="#tools:sample/avatars" />
</LinearLayout>
Try a better library for this there are many.
This I common requirement so you can get a lot of examples.
I am not able to find out the exact issue that why the image(background) is not visible in API level 16 but it is showing good in API level 19. I have worked simply as i have done previously but , this time the background is not shown(of WaterMark in ImageView).
I am not able to find out what is exact issue . So i need help.I have done every thing as suggested in the stack Android device is not showing the background image but it is not going good in my case.
xml
<?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:orientation="vertical">
<ScrollView
android:id="#+id/scrollLogin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/rlGetInTouch"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#304EA2">
<RelativeLayout
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/header_bg2">
<ImageView
android:id="#+id/brand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/nbl_logo4" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#304EA2">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginBottom="35dp"
android:layout_marginTop="-60dp"
android:color="#android:color/transparent"
android:src="#drawable/logowatermark" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/edit_text_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingLeft="35dp"
android:paddingRight="35dp">
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text=" Please login to proceed"
android:textColor="#color/white"
android:textSize="12sp"
android:textStyle="normal" />
<******.CustomFontEditText
android:id="#+id/etUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:background="#drawable/edit_text_border"
android:drawablePadding="8dp"
android:gravity="center"
android:hint="Mobile Number"
android:inputType="number"
android:maxLength="#integer/mobile_length"
android:padding="13dp"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="12dp"
android:textStyle="bold" />
<******.CustomFontEditText
android:id="#+id/etPassword"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="12dp"
android:layout_toLeftOf="#+id/passwordVisibilityBtn"
android:background="#drawable/edit_text_border"
android:drawablePadding="8dp"
android:gravity="center"
android:hint="Password"
android:inputType="textPassword"
android:maxLength="#integer/password_length"
android:padding="13dp"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="12dp"
android:textStyle="bold" />
<******.CustomFontCheckBox
android:id="#+id/chkSaveUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:button="#drawable/custom_checkbox"
android:drawablePadding="5dp"
android:gravity="center"
android:text=" Remember Mobile No."
android:textColor="#color/white"
android:textSize="12sp"
android:textStyle="normal" />
<LinearLayout
android:id="#+id/loginLl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#drawable/login_button_shadow"
android:orientation="vertical">
<******.CustomFontLoginTextView
android:id="#+id/btnLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#drawable/login_button_new1"
android:clickable="true"
android:gravity="center"
android:padding="13dp"
android:text="Login"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="14sp" />
<******.CustomFontLoginTextView
android:id="#+id/action_sms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:background="#drawable/login_button_new1"
android:clickable="true"
android:gravity="center"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="10dp"
android:text="Switch To SMS"
android:textColor="#color/white"
android:textSize="12sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<******.CustomFontLoginTextView
android:id="#+id/resetDeviceId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:alpha="0.7"
android:drawableLeft="#drawable/icon_reset_20"
android:drawablePadding="3dp"
android:gravity="center"
android:text="#string/reset_device_id_text"
android:textColor="#color/white"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:id="#+id/action_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:alpha="0.7"
android:drawableLeft="#drawable/icon_info_20"
android:drawablePadding="3dp"
android:gravity="center"
android:text="#string/info"
android:textColor="#color/white"
android:textSize="12sp" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<!-- Promo -->
<LinearLayout
android:id="#+id/llPromotions"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/promo_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/llBranches"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rlLogin"
android:layout_gravity="center"
android:background="#304EA2"
android:gravity="center"
android:orientation="horizontal"
android:padding="15dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="true"
android:onClick="showATMs"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:padding="2dp"
android:src="#drawable/icon_atm_50_6" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:text="ATM"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="3dp"
android:text="Locate nearest Atm Machines"
android:textColor="#FFFFFF"
android:textSize="8sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="true"
android:onClick="showBranches"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="2dp"
android:src="#drawable/ic_branches_50_6" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="8dp"
android:text="BRANCHES"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="3dp"
android:text="Locate nearest bank branches"
android:textColor="#FFFFFF"
android:textSize="8sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:clickable="true"
android:onClick="showRates"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="2dp"
android:src="#drawable/ic_rates_50_6" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:text="RATES"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="3dp"
android:text="Foreign exchange and stock rates"
android:textColor="#FFFFFF"
android:textSize="8sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/rlProducts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="vertical">
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Products"
android:textAllCaps="true"
android:textColor="#color/gray"
android:textSize="14sp" />
<!--Product Container-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!--Product 1-->
<LinearLayout
android:id="#+id/product_content1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="7.5dp"
android:layout_weight="1"
android:orientation="vertical" />
<!--Product 2-->
<LinearLayout
android:id="#+id/product_content2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="7.5dp"
android:layout_marginRight="15dp"
android:layout_weight="1"
android:gravity="end"
android:orientation="vertical" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/rlGetInTouch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#304EA2"
android:orientation="horizontal">
<CustomFontLoginTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/btnCall"
android:paddingLeft="15dp"
android:singleLine="true"
android:text="Get in touch with us"
android:textColor="#color/white"
android:textSize="16sp"
android:textStyle="normal" />
<!--app:maxTextSize="14sp"
app:minTextSize="#dimen/minFontSize"-->
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/btnMap"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dp"
android:onClick="showLocation"
android:src="#drawable/ic_action_location_24_4" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/btnEmail"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/btnMap"
android:layout_toStartOf="#+id/btnMap"
android:onClick="openEmail"
android:src="#drawable/ic_action_mail_24_4" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/btnCall"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/btnEmail"
android:layout_toStartOf="#+id/btnEmail"
android:onClick="openCall"
android:src="#drawable/ic_action_call_24_4" />
</RelativeLayout>
</RelativeLayout>
The Image background of watermark is not shown. I have done nothing
new ,same as previous but dont' know that is the exact issue.
Please reduce image size to visible in the lower level device.
I Just Removed marginTop and it worked fine in API level 16
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginBottom="35dp"
android:src="#drawable/logowatermark" />
I don't understand that why it worked when i remove the -ve marginTop
in above? .I got solution but don't understand what exactly happened
in adding -ve marginTop and with removing -ve marginTop.
I am using nested scrollview. Inside the nested scrollview,
I have two title (Text and button)
and then below another text
then followed by recyclerview below the layout.
Then below the recyclerview, there is two edittext and submit button.
Structure looks like this.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorWhite"
android:isScrollContainer="false"
android:paddingBottom="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!--Profile icon-->
<include layout="#layout/common_profile_layout" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="26dp"
android:background="#color/colorGrey">
<TextView
android:id="#+id/count_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="24dp"
android:gravity="center"
android:text="Ringkasan Aktifitas"
android:textColor="?attr/colorUserGroup" />
<Button
android:id="#+id/dafatar_filter"
android:layout_width="72dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:background="#drawable/curve_corner_change_day"
android:clickable="true"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="Pilih Tanggal"
android:textAllCaps="false"
android:textColor="#android:color/white"
android:textSize="10sp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical">
<TextView
android:id="#+id/dateTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:text="06/13/2017"
android:textColor="#color/colorBlack"
android:textSize="#dimen/text_size_small" />
</LinearLayout>
//here is recyclerview where loading items.
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="19dp"
android:background="#color/colorWhite" />
//here below recyclerview, another edittext with buttons
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#color/edit_retailer_light_color"
android:orientation="vertical"
android:paddingBottom="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="21dp"
android:layout_marginTop="22dp"
android:text="Laporan Via"
android:textColor="#color/colorBlack"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="13dp"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/sms_rel"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/sms_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="32dp"
android:layout_marginTop="3dp"
android:src="#drawable/ic_mark_white" />
<TextView
android:id="#+id/sms_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:layout_marginTop="3dp"
android:layout_toRightOf="#+id/sms_icon"
android:text="SMS" />
<EditText
android:id="#+id/edtSms"
android:layout_width="222dp"
android:layout_height="28dp"
android:layout_marginLeft="19dp"
android:layout_toRightOf="#+id/sms_text"
android:background="#drawable/edittext_border_curve"
android:focusable="true"
android:focusableInTouchMode="true"
android:inputType="number"
android:paddingLeft="5dp"
android:text="+62"
android:textColor="#color/colorBlack"
android:textSize="#dimen/text_size_small" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/rel_1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/email_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="32dp"
android:layout_marginTop="2dp"
android:src="#drawable/ic_mark_white" />
<TextView
android:id="#+id/email_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:layout_marginTop="3dp"
android:layout_toRightOf="#+id/email_icon"
android:text="Email" />
<EditText
android:id="#+id/emailSms"
android:layout_width="222dp"
android:layout_height="28dp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="#+id/email_text"
android:background="#drawable/edittext_border_curve"
android:inputType="textEmailAddress"
android:paddingLeft="5dp"
android:text="bejo#gmail.com"
android:textColor="#color/colorBlack"
android:textSize="#dimen/text_size_small" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp">
<Button
android:id="#+id/submit_btn"
android:layout_width="148dp"
android:layout_height="30dp"
android:layout_centerInParent="true"
android:background="#drawable/curve_corner"
android:gravity="center"
android:text="Kirim"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="#dimen/text_size_small" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
But problem is, when I launch, it always displays only from recycler list when there is more items and it's not displaying from top of recycler view items ie from above recyclerview layouts (titles).
In code,
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, OrientationHelper.VERTICAL, false);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setNestedScrollingEnabled(false); // i used only this..
recyclerView.setAdapter(adapter);
recycler_item_rows.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:weightSum="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="8dp">
<ImageView
android:id="#+id/recycle_profile"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginLeft="16dp"
android:src="#drawable/ic_tag" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:layout_marginLeft="16dp"
android:orientation="vertical">
<TextView
android:id="#+id/recycle_txt_acc_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="false"
android:text="Sell in"
android:textColor="#color/colorBlack"
android:textSize="#dimen/text_size_small" />
<TextView
android:id="#+id/recycle_txt_acc_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="false"
android:text="Selli Cell"
android:textColor="?attr/colorUserGroup"
android:textSize="#dimen/text_size_very_small" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<TextView
android:id="#+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="21dp"
android:layout_marginTop="12dp"
android:gravity="center"
android:text="12/11/2017 1.30"
android:textColor="#color/colorBlack"
android:textSize="#dimen/text_size_very_small" />
</RelativeLayout>
</LinearLayout>
Kindly correct my mistake to display from top.
Here is my output:
Where it's not displaying from top. And I need to manually scroll to top.
Add this line of code to main LinearLayout android:focusableInTouchMode="true"
I need to align the images and buttons equall with the header but it's not assigning. When I check in landscape, align getting mismatch. Here is my code.
When I checked in device, it's not fitting correctly.
Below is the code and output screen (My output and actual output which needed).
I used weight but it's not fitting correctly in all devices.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="29dp"
android:layout_marginTop="16dp"
android:background="#color/colorAlabaster">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView9"
android:layout_alignBottom="#+id/textView9"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="50dp"
android:gravity="center"
android:text="Retailer" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:text="Hari sebelumnya" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:text="Pindahkan ke hari" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:layout_weight="1">
<com.hutchison.h3i.newangie.customviews.CircleImageView
android:id="#+id/recycle_profile"
android:layout_width="#dimen/growth_sell_in_out_icon_size"
android:layout_height="#dimen/growth_sell_in_out_icon_size"
android:layout_gravity="center"
android:layout_marginLeft="16dp"
android:src="#drawable/ic_default_profile" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:orientation="vertical">
<TextView
android:id="#+id/recycle_txt_acc_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="false"
android:text="#string/route_plan_default_number"
android:textColor="#color/colorBlack"
android:textSize="#dimen/text_size_very_small" />
<TextView
android:id="#+id/recycle_txt_acc_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="false"
android:text="#string/route_plan_default_name"
android:textColor="#color/colorCyan"
android:textSize="#dimen/text_size_very_small" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1">
<android.support.v7.widget.AppCompatButton
android:layout_width="86dp"
android:layout_height="29dp"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:layout_marginLeft="8dp"
android:background="#drawable/border_grey_curve"
android:text="Selasa"
android:textAllCaps="false"
android:textColor="#color/colorBlack" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight=".2">
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:background="#drawable/ic_arrow_right"
android:gravity="center"
android:textColor="#color/colorBlack"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_weight="1">
<android.support.v7.widget.AppCompatButton
android:layout_width="86dp"
android:layout_height="29dp"
android:background="#drawable/border_grey_curve"
android:drawablePadding="5dp"
android:drawableRight="#drawable/ic_arrow_bottom"
android:singleLine="true"
android:text="Kamis"
android:textAllCaps="false"
android:textColor="#color/colorBlack"
android:textSize="#dimen/text_size_small" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
My Output:
Actual output:
Here i have fixed the issue for you. But as the screen size will increase so does the size between your button and upper portion too. But your layout won't get messy. And if you want everything to remain fixed even on bigger screen sizes then you should use constraintLayout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="29dp"
android:layout_marginTop="16dp"
android:background="#color/colorPrimaryLight">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView9"
android:layout_alignBottom="#+id/textView9"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="50dp"
android:gravity="center"
android:text="Retailer" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:text="Hari sebelumnya" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:text="Pindahkan ke hari" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:weightSum="4">
<com.hutchison.h3i.newangie.customviews.CircleImageView
android:id="#+id/recycle_profile"
android:layout_width="#dimen/growth_sell_in_out_icon_size"
android:layout_height="#dimen/growth_sell_in_out_icon_size"
android:layout_gravity="center"
android:layout_marginLeft="16dp"
android:src="#drawable/ic_default_profile" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:layout_weight="0.5"
android:orientation="vertical">
<TextView
android:id="#+id/recycle_txt_acc_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="false"
android:text="sad234 234234"
android:textColor="#color/primary_text"
android:textSize="12sp" />
<TextView
android:id="#+id/recycle_txt_acc_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="false"
android:text="#string/title_activity_test"
android:textColor="#color/secondary_text"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1.5">
<android.support.v7.widget.AppCompatButton
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="8dp"
android:background="#drawable/bg_spinner_nothing_selected"
android:gravity="center"
android:text="Selasa"
android:textAllCaps="false"
android:textColor="#color/primary_text" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight=".5">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:background="#drawable/ic_add"
android:gravity="center"
android:textColor="#color/primary_text"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_weight="1.5">
<android.support.v7.widget.AppCompatButton
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="#drawable/bg_spinner_nothing_selected"
android:drawableRight="#drawable/ic_edit_grey"
android:singleLine="true"
android:text="Kamis"
android:textAllCaps="false"
android:textColor="#color/primary_text"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Hope it will help you. I have replaced the colors and ic_images with mine you will have to change them too by your own.
Hope this would work. I redesign with your same xml file.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="29dp"
android:layout_marginTop="16dp"
android:background="#color/colorAlabaster">
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Retailer" />
<TextView
android:id="#+id/textView9"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Hari sebelumnya" />
<TextView
android:layout_width="0dp"
android:layout_weight=".2"
android:layout_height="wrap_content"
android:gravity="center" />
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Pindahkan ke hari" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginLeft="8dp"
android:layout_weight="1">
<LinearLayout
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<com.hutchison.h3i.newangie.customviews.CircleImageViewx
android:id="#+id/recycle_profile"
android:layout_width="#dimen/growth_sell_in_out_icon_size"
android:layout_height="#dimen/growth_sell_in_out_icon_size"
android:layout_gravity="center"
android:layout_marginLeft="16dp"
android:src="#drawable/ic_default_profile" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/recycle_txt_acc_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="false"
android:text="#string/route_plan_default_number"
android:textColor="#color/colorBlack"
android:textSize="#dimen/text_size_very_small" />
<TextView
android:id="#+id/recycle_txt_acc_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="false"
android:text="#string/route_plan_default_name"
android:textColor="#color/colorCyan"
android:textSize="#dimen/text_size_very_small" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1">
<android.support.v7.widget.AppCompatButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:background="#drawable/border_grey_curve"
android:text="Selasa"
android:textAllCaps="false"
android:textColor="#color/colorBlack" />
</LinearLayout>
<LinearLayout
android:layout_weight=".2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center">
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:background="#drawable/ic_arrow_right"
android:gravity="center"
android:textColor="#color/colorBlack"
android:textSize="16dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1">
<android.support.v7.widget.AppCompatButton
android:layout_width="86dp"
android:layout_height="29dp"
android:background="#drawable/border_grey_curve"
android:drawablePadding="5dp"
android:drawableRight="#drawable/ic_arrow_bottom"
android:singleLine="true"
android:text="Kamis"
android:textAllCaps="false"
android:textColor="#color/colorBlack"
android:textSize="#dimen/text_size_small" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
I am developing an app which i have to divide the cardview to 2 parts.
I have done this :
But i want to move my blue button to top as this image shows below and change the background color to grey :
This my custom layout code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:background="#color/Grey_300"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:layout_height="wrap_content"
app:cardBackgroundColor="#color/Grey_50"
app:cardCornerRadius="3dp"
card_view:cardCornerRadius="0dp">
<RelativeLayout
android:layoutDirection="ltr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<ImageView
android:id="#+id/imageview_video"
android:layout_width="150dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_height="100dp" />
<TextView
android:id="#+id/txt_overimage"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:paddingBottom="2dp"
android:paddingTop="2dp"
android:background="#color/myred"
android:textColor="#color/white"
android:textStyle="bold"
android:textSize="14sp"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="#+id/txt_amazon_title"
android:layout_toRightOf="#+id/imageview_video"
android:layout_toEndOf="#+id/imageview_video"
android:layout_width="wrap_content"
android:textSize="15sp"
android:maxLength="100"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/txt_datetimevideo"
android:layout_toRightOf="#+id/imageview_video"
android:layout_toEndOf="#+id/imageview_video"
android:textColor="#color/Grey_500"
android:layout_below="#+id/txt_amazon_title"
android:textSize="14sp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="#+id/bt_deal"
android:text="Voir le deal"
android:backgroundTint="#drawable/back_amazon"
android:textColor="#color/white"
android:textSize="14sp"
android:layout_below="#+id/txt_datetimevideo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<View
android:id="#+id/view_video"
android:layout_below="#+id/bt_deal"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
android:layout_marginTop="10dp"
/>
<ImageView
android:id="#+id/favorite"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:layout_marginTop="5dp"
android:layout_below="#+id/view_video"
android:background="#drawable/favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</ScrollView>
</LinearLayout>
How can i do that ? Should i create another linearLayout and add the button inside the linearlayout ?
My updated code and image after adding linearlayout inside cardview :
updated code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:background="#color/Grey_300"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:layout_height="wrap_content"
app:cardBackgroundColor="#color/Grey_50"
app:cardCornerRadius="3dp"
card_view:cardCornerRadius="0dp">
<LinearLayout
android:id="#+id/linear2"
android:background="#color/Grey_300"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="#+id/rela1"
android:background="#color/Grey_300"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/bt_deal2"
android:text="Voir le deal"
android:backgroundTint="#drawable/back_amazon"
android:textColor="#color/white"
android:textSize="14sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:layoutDirection="ltr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<ImageView
android:id="#+id/imageview_video"
android:layout_width="150dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_height="100dp" />
<TextView
android:id="#+id/txt_overimage"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:paddingBottom="2dp"
android:paddingTop="2dp"
android:background="#color/myred"
android:textColor="#color/white"
android:textStyle="bold"
android:textSize="14sp"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="#+id/txt_amazon_title"
android:layout_toRightOf="#+id/imageview_video"
android:layout_toEndOf="#+id/imageview_video"
android:layout_width="wrap_content"
android:textSize="15sp"
android:maxLength="100"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/txt_datetimevideo"
android:layout_toRightOf="#+id/imageview_video"
android:layout_toEndOf="#+id/imageview_video"
android:textColor="#color/Grey_500"
android:layout_below="#+id/txt_amazon_title"
android:textSize="14sp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="#+id/bt_deal"
android:text="I HIDE BUTTON FOR REMOVING AFTER"
android:backgroundTint="#drawable/back_amazon"
android:textColor="#color/white"
android:textSize="14sp"
android:visibility="gone"
android:layout_below="#+id/txt_datetimevideo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<View
android:id="#+id/view_video"
android:layout_below="#+id/bt_deal"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
android:layout_marginTop="10dp"
/>
<ImageView
android:id="#+id/favorite"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:layout_marginTop="5dp"
android:layout_below="#+id/view_video"
android:background="#drawable/favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</ScrollView>
</LinearLayout>
Try adding both your linearlayouts inside a parent linearlayout with orientation vertical.