This is my UI page that I want it to appear on my physical emulator
img1 and this is the expected output
img2
Android UI Design Problem
I really don't know why that is happening I used actually Relativelayout and thanks in advance
I don't use XML a lot so I'm kinda new to using UI stuff here in android
and here is my XML code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/relativeLayout4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#fff"
tools:context="com.example.splash.StartActivity">
<RelativeLayout
android:id="#+id/zeroPart"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-5sp"
android:scaleType="fitXY"
tools:srcCompat="#drawable/ic_pexels_george_sultan_1409999" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/firstPart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="186sp">
<ImageView
android:id="#+id/fixNowImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="#FFFFFF"
android:src="#drawable/ic_fixnowtheoriginallogo" />
<TextView
android:id="#+id/fix"
android:layout_width="wrap_content"
android:layout_height="31sp"
android:layout_below="#+id/fixNowImage"
android:layout_marginLeft="165sp"
android:fontFamily="#font/poppins_bold_italic"
android:text="Fix"
android:textColor="#f05454"
android:textSize="22sp" />
<TextView
android:id="#+id/nowPart"
android:layout_width="wrap_content"
android:layout_height="31sp"
android:layout_below="#+id/fixNowImage"
android:layout_centerHorizontal="true"
android:layout_toRightOf="#+id/fix"
android:fontFamily="#font/poppins_bold_italic"
android:text="Now"
android:textColor="#30475e"
android:textSize="22sp" />
<TextView
android:id="#+id/subLogoPart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/fix"
android:layout_marginLeft="123sp"
android:fontFamily="#font/poppins"
android:gravity="center_horizontal"
android:lineSpacingExtra="6sp"
android:text="Sharing smile through car caring"
android:textColor="#30475e"
android:textSize="10sp"
android:textStyle="normal" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/secondPart"
android:layout_width="match_parent"
android:layout_below="#+id/firstPart"
android:layout_height="wrap_content"
android:layout_marginTop="80sp">
<Button
android:id="#+id/Button_CreateAccount"
android:layout_width="364sp"
android:layout_height="55sp"
android:layout_marginLeft="24sp"
android:layout_marginRight="24sp"
android:background="#drawable/ic_rectangle_31"
android:fontFamily="#font/poppins"
android:lineSpacingExtra="9sp"
android:text="Create an account"
android:textAppearance="#style/TextAppearance.AppCompat.Body1"
android:textColor="#fff"
android:textSize="16sp"
android:textStyle="normal"
tools:text="Create an account" />
<Button
android:id="#+id/Button_SignIn"
android:layout_width="364sp"
android:layout_height="55sp"
android:layout_below="#+id/Button_CreateAccount"
android:layout_marginLeft="24sp"
android:layout_marginTop="20sp"
android:layout_marginRight="24sp"
android:background="#drawable/ic_rectangle_32"
android:fontFamily="#font/poppins"
android:lineSpacingExtra="9sp"
android:text="Sign in"
android:textAppearance="#style/TextAppearance.AppCompat.Body1"
android:textColor="#30475e"
android:textSize="16sp"
android:textStyle="normal"
tools:text="Sign in" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/thirdPart"
android:layout_width="match_parent"
android:layout_below="#+id/secondPart"
android:layout_height="wrap_content"
android:layout_marginTop="44sp">
<ImageView
android:id="#+id/firstLineOfOr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="24sp"
android:layout_marginTop="9.5sp"
android:layout_marginBottom="11.5sp"
tools:srcCompat="#drawable/ic_line_1" />
<TextView
android:id="#+id/theOR"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="17sp"
android:layout_toRightOf="#+id/firstLineOfOr"
android:fontFamily="#font/poppins"
android:gravity="center_horizontal"
android:lineSpacingExtra="5sp"
android:text="Or"
android:textColor="#49454f"
android:textSize="15sp"
android:textStyle="normal" />
<ImageView
android:id="#+id/SecondLineOfOr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="17sp"
android:layout_marginTop="9.5sp"
android:layout_marginRight="23.5sp"
android:layout_marginBottom="11.5sp"
android:layout_toRightOf="#id/theOR"
tools:srcCompat="#drawable/ic_line_1" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/fourthPart"
android:layout_below="#+id/thirdPart"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/Button_LoginWithGoogle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="24sp"
android:layout_marginTop="25sp"
android:layout_marginRight="24sp"
android:background="#drawable/ic_rectangle_1451"
android:drawableLeft="#drawable/ic_google"
android:drawablePadding="12.5sp"
android:fontFamily="#font/poppins"
android:gravity="left|center"
android:lineSpacingExtra="7sp"
android:paddingLeft="103.6sp"
android:text="Login with Google"
android:textAppearance="#style/TextAppearance.AppCompat.Body1"
android:textColor="#30475e"
android:textSize="14sp"
android:textStyle="normal" />
/>
<Button
android:id="#+id/Button_LoginWithFacebook"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/Button_LoginWithGoogle"
android:layout_marginLeft="24sp"
android:layout_marginTop="10sp"
android:layout_marginRight="24sp"
android:background="#drawable/ic_rectangle_1451"
android:drawableLeft="#drawable/ic_facebook"
android:drawablePadding="12.2sp"
android:fontFamily="#font/poppins"
android:gravity="left|center"
android:lineSpacingExtra="7sp"
android:paddingLeft="109.2sp"
android:text="Login with Google"
android:textAppearance="#style/TextAppearance.AppCompat.Body1"
android:textColor="#30475e"
android:textSize="14sp"
android:textStyle="normal" />
/>
</RelativeLayout>
</RelativeLayout>
Try this xml code , where I edited your xml with some small corrections. I haven't corrected padding to image on button, but that can be done easily upon your requirements.
Instead of using Button you could also try using TextView inside any Layout and add an ImageView at the required position. Hope this solves your issue.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/relativeLayout4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:gravity="center"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/zeroPart"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-5sp"
android:scaleType="fitXY" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/firstPart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="186sp"
android:gravity="center">
<ImageView
android:id="#+id/fixNowImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="#FFFFFF"
android:src="#drawable/ic_fixnowtheoriginallogo" />
<LinearLayout
android:id="#+id/fix"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/fixNowImage"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Fix"
android:textColor="#f05454"
android:textSize="22sp" />
<TextView
android:id="#+id/nowPart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Now"
android:textColor="#30475e"
android:textSize="22sp" />
</LinearLayout>
<TextView
android:id="#+id/subLogoPart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/fix"
android:gravity="center_horizontal"
android:lineSpacingExtra="6sp"
android:text="Sharing smile through car caring"
android:textColor="#30475e"
android:textSize="10sp"
android:textStyle="normal" />
</RelativeLayout>
<LinearLayout
android:id="#+id/secondPart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/firstPart"
android:layout_centerHorizontal="true"
android:layout_marginTop="80sp"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="#+id/Button_CreateAccount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_rectangle_31"
android:lineSpacingExtra="9sp"
android:paddingStart="80dp"
android:paddingEnd="80dp"
android:text="Create an account"
android:textAppearance="#style/TextAppearance.AppCompat.Body1"
android:textColor="#fff"
android:textSize="16sp"
android:textStyle="normal"
tools:text="Create an account" />
<Button
android:id="#+id/Button_SignIn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20sp"
android:background="#drawable/ic_rectangle_31"
android:lineSpacingExtra="9sp"
android:text="Sign in"
android:textAppearance="#style/TextAppearance.AppCompat.Body1"
android:textColor="#30475e"
android:textSize="16sp"
android:textStyle="normal"
tools:text="Sign in" />
</LinearLayout>
<RelativeLayout
android:id="#+id/thirdPart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/secondPart"
android:layout_marginTop="40sp">
<!-- <ImageView-->
<!-- android:id="#+id/firstLineOfOr"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginLeft="24sp"-->
<!-- android:layout_marginTop="9.5sp"-->
<!-- android:layout_marginBottom="11.5sp"-->
<!-- tools:srcCompat="#drawable/arrow_down" />-->
<TextView
android:id="#+id/theOR"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:lineSpacingExtra="5sp"
android:text="Or"
android:textColor="#49454f"
android:textSize="15sp"
android:textStyle="normal" />
<!-- <ImageView-->
<!-- android:id="#+id/SecondLineOfOr"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginLeft="17sp"-->
<!-- android:layout_marginTop="9.5sp"-->
<!-- android:layout_marginRight="23.5sp"-->
<!-- android:layout_marginBottom="11.5sp"-->
<!-- android:layout_toRightOf="#id/theOR"-->
<!-- tools:srcCompat="#drawable/arrow_down" />-->
</RelativeLayout>
<LinearLayout
android:id="#+id/fourthPart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/thirdPart"
android:layout_centerHorizontal="true"
android:layout_marginTop="25sp"
android:orientation="vertical">
<Button
android:id="#+id/Button_LoginWithGoogle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_rectangle_1451"
android:drawableStart="#drawable/ic_google"
android:drawablePadding="12.5sp"
android:gravity="center"
android:lineSpacingExtra="7sp"
android:paddingStart="103.6sp"
android:text="Login with Google"
android:textAppearance="#style/TextAppearance.AppCompat.Body1"
android:textColor="#30475e"
android:textSize="14sp"
android:textStyle="normal"
tools:ignore="RtlSymmetry" />
<Button
android:id="#+id/Button_LoginWithFacebook"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:background="#drawable/ic_rectangle_1451"
android:drawableStart="#drawable/ic_facebook"
android:drawablePadding="12.2sp"
android:gravity="center"
android:lineSpacingExtra="7sp"
android:paddingStart="109.2sp"
android:text="Login with Fb"
android:textAppearance="#style/TextAppearance.AppCompat.Body1"
android:textColor="#30475e"
android:textSize="14sp"
android:textStyle="normal"
tools:ignore="RtlSymmetry" />
</LinearLayout>
</RelativeLayout>
Related
I,m designing one layout file which contain education information , earlier information was not fitting into screen so I have added Scroll view. I'm able to scroll down the screen but not completely. I tried putt scrollView top of all the relative layout, but it not scrolling completely, i tried enter link description here but not able to resolve my problem.
need help?
fragment_education.xml
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/slide_title"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="#dimen/slide_title"
android:background="#color/Blue"
android:paddingLeft="#dimen/slide_title">
<RelativeLayout
android:id="#+id/be_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/be_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2016"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/college"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/be_year"
android:text="SKIT,Banglore"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/course"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/college"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/be_year"
android:text="#string/course_detail"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/th12_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/be_details"
android:layout_marginTop="#dimen/slide_title">
<TextView
android:id="#+id/th12_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2012"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/th12_college"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/th12_year"
android:text="SLIC,Rampur"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/th12_course"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/th12_college"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#id/th12_year"
android:text="#string/th12_details"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/school_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/th12_detail"
android:layout_marginTop="#dimen/slide_title">
<TextView
android:id="#+id/scl_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2010"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/scl_school"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/scl_year"
android:text="SRHS,Tanda"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/scl_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/scl_school"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#id/scl_year"
android:text="#string/school_details"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
where am doing wrong?
Remove android:layout_marginBottom="#dimen/slide_title" and android:layout_marginTop="#dimen/slide_title"from first RelativeLayout after ScrollView and it will work
The only things to be done for the solution just add a nested scroll view within the scrollview here is the working code :
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/slide_title"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="#dimen/slide_title"
android:background="#color/Blue"
android:paddingLeft="#dimen/slide_title">
<RelativeLayout
android:id="#+id/be_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/be_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2016"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/college"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/be_year"
android:text="SKIT,Banglore"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/course"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/college"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/be_year"
android:text="#string/course_detail"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/th12_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/be_details"
android:layout_marginTop="#dimen/slide_title">
<TextView
android:id="#+id/th12_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2012"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/th12_college"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/th12_year"
android:text="SLIC,Rampur"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/th12_course"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/th12_college"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#id/th12_year"
android:text="#string/th12_details"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/school_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/th12_detail"
android:layout_marginTop="#dimen/slide_title">
<TextView
android:id="#+id/scl_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2010"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/scl_school"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/scl_year"
android:text="SRHS,Tanda"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/scl_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/scl_school"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#id/scl_year"
android:text="#string/school_details"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</ScrollView>
I used 20 spinners and 40 textviews for displaying the name poster. When I edit this xml resource file Android Studio showing popup is Out of memory error
Here is the popup
I incresed the xmx size to 2048.
Eventhogh it showing same error when I open that xml file. here I put the xml code.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/adViewContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.85">
<RelativeLayout
android:id="#+id/relNameLayout"
android:layout_width="match_parent"
android:layout_height="fill_parent">
<TextView
android:id="#+id/spinner"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="18dp"
android:layout_marginStart="18dp"
android:layout_marginTop="15dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/spinner"
android:layout_marginLeft="25dp"
android:layout_marginStart="25dp"
android:layout_toRightOf="#+id/spinner"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/spinner3"
android:layout_alignTop="#+id/spinner"
android:layout_marginLeft="25dp"
android:layout_marginStart="25dp"
android:layout_toRightOf="#+id/spinner"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner"
android:layout_alignLeft="#+id/spinner"
android:layout_alignRight="#+id/spinner"
android:layout_alignStart="#+id/spinner"
android:layout_below="#+id/spinner"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner2"
android:layout_alignStart="#+id/spinner2"
android:layout_alignTop="#+id/spinner3"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/spinner5"
android:layout_alignLeft="#+id/spinner4"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="#+id/spinner4"
android:layout_alignTop="#+id/spinner4"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner3"
android:layout_alignLeft="#+id/spinner3"
android:layout_alignRight="#+id/spinner3"
android:layout_alignStart="#+id/spinner3"
android:layout_below="#+id/spinner3"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner4"
android:layout_alignStart="#+id/spinner4"
android:layout_alignTop="#+id/spinner5"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/spinner7"
android:layout_alignLeft="#+id/spinner6"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="#+id/spinner6"
android:layout_alignTop="#+id/spinner6"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner5"
android:layout_alignLeft="#+id/spinner5"
android:layout_alignRight="#+id/spinner5"
android:layout_alignStart="#+id/spinner5"
android:layout_below="#+id/spinner5"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner6"
android:layout_alignStart="#+id/spinner6"
android:layout_alignTop="#+id/spinner7"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/spinner9"
android:layout_alignLeft="#+id/spinner6"
android:layout_alignStart="#+id/spinner6"
android:layout_alignTop="#+id/spinner7"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner7"
android:layout_alignLeft="#+id/spinner7"
android:layout_alignRight="#+id/spinner7"
android:layout_alignStart="#+id/spinner7"
android:layout_below="#+id/spinner7"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner8"
android:layout_alignStart="#+id/spinner8"
android:layout_alignTop="#+id/spinner9"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/spinner11"
android:layout_alignLeft="#+id/spinner8"
android:layout_alignStart="#+id/spinner8"
android:layout_alignTop="#+id/spinner9"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner11"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner9"
android:layout_alignLeft="#+id/spinner9"
android:layout_alignRight="#+id/spinner9"
android:layout_alignStart="#+id/spinner9"
android:layout_below="#+id/spinner9"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner12"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner10"
android:layout_alignStart="#+id/spinner10"
android:layout_alignTop="#+id/spinner11"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner12"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/spinner13"
android:layout_alignLeft="#+id/spinner12"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="#+id/spinner12"
android:layout_alignTop="#+id/spinner12"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner13"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner11"
android:layout_alignLeft="#+id/spinner11"
android:layout_alignRight="#+id/spinner11"
android:layout_alignStart="#+id/spinner11"
android:layout_below="#+id/spinner11"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner12"
android:layout_alignStart="#+id/spinner12"
android:layout_alignTop="#+id/spinner13"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/spinner15"
android:layout_alignLeft="#+id/spinner12"
android:layout_alignStart="#+id/spinner12"
android:layout_alignTop="#+id/spinner13"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner15"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner13"
android:layout_alignLeft="#+id/spinner13"
android:layout_alignRight="#+id/spinner13"
android:layout_alignStart="#+id/spinner13"
android:layout_below="#+id/spinner13"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner16"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner14"
android:layout_alignStart="#+id/spinner14"
android:layout_alignTop="#+id/spinner15"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner16"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner14"
android:layout_alignStart="#+id/spinner14"
android:layout_alignTop="#+id/spinner15"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner17"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner15"
android:layout_alignLeft="#+id/spinner15"
android:layout_alignRight="#+id/spinner15"
android:layout_alignStart="#+id/spinner15"
android:layout_below="#+id/spinner15"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner18"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner16"
android:layout_alignStart="#+id/spinner16"
android:layout_alignTop="#+id/spinner17"
android:layout_below="#+id/spinner16"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner18"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner16"
android:layout_alignStart="#+id/spinner16"
android:layout_alignTop="#+id/spinner17"
android:layout_below="#+id/txtSpinner16"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner19"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner17"
android:layout_alignLeft="#+id/spinner17"
android:layout_alignRight="#+id/spinner17"
android:layout_alignStart="#+id/spinner17"
android:layout_below="#+id/spinner17"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner20"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner18"
android:layout_alignStart="#+id/spinner18"
android:layout_alignTop="#+id/spinner19"
android:layout_below="#+id/spinner18"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner20"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner18"
android:layout_alignStart="#+id/spinner18"
android:layout_alignTop="#+id/spinner19"
android:layout_below="#+id/txtSpinner18"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner21"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner19"
android:layout_alignLeft="#+id/spinner19"
android:layout_alignRight="#+id/spinner19"
android:layout_alignStart="#+id/spinner19"
android:layout_below="#+id/spinner19"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner22"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner20"
android:layout_alignStart="#+id/spinner20"
android:layout_alignTop="#+id/spinner21"
android:layout_below="#+id/spinner20"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner22"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner20"
android:layout_alignStart="#+id/spinner20"
android:layout_alignTop="#+id/spinner21"
android:layout_below="#+id/txtSpinner20"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner23"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner21"
android:layout_alignLeft="#+id/spinner21"
android:layout_alignRight="#+id/spinner21"
android:layout_alignStart="#+id/spinner21"
android:layout_below="#+id/spinner21"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner24"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner22"
android:layout_alignStart="#+id/spinner22"
android:layout_alignTop="#+id/spinner23"
android:layout_below="#+id/spinner22"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner24"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner22"
android:layout_alignStart="#+id/spinner22"
android:layout_alignTop="#+id/spinner23"
android:layout_below="#+id/txtSpinner22"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner25"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner23"
android:layout_alignLeft="#+id/spinner23"
android:layout_alignRight="#+id/spinner23"
android:layout_alignStart="#+id/spinner23"
android:layout_below="#+id/spinner23"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner26"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner24"
android:layout_alignStart="#+id/spinner24"
android:layout_alignTop="#+id/spinner25"
android:layout_below="#+id/spinner24"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner26"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner24"
android:layout_alignStart="#+id/spinner24"
android:layout_alignTop="#+id/spinner25"
android:layout_below="#+id/txtSpinner24"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner27"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner25"
android:layout_alignLeft="#+id/spinner25"
android:layout_alignRight="#+id/spinner25"
android:layout_alignStart="#+id/spinner25"
android:layout_below="#+id/spinner25"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner28"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner26"
android:layout_alignStart="#+id/spinner26"
android:layout_alignTop="#+id/spinner27"
android:layout_below="#+id/spinner26"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner28"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner26"
android:layout_alignStart="#+id/spinner26"
android:layout_alignTop="#+id/spinner27"
android:layout_below="#+id/txtSpinner26"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner29"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner27"
android:layout_alignLeft="#+id/spinner27"
android:layout_alignRight="#+id/spinner27"
android:layout_alignStart="#+id/spinner27"
android:layout_below="#+id/spinner27"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner30"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner28"
android:layout_alignStart="#+id/spinner28"
android:layout_alignTop="#+id/spinner29"
android:layout_below="#+id/spinner28"
android:visibility="invisible" />
.........
..........
.........
</RelativeLayout>
</ScrollView>
I used 20 spinners and 40 textviews layout to display a poster as following shown. Is there any other way to get that please do let me know.
My poster
I was fighting with this problem today for a few hours and ended up trying File -> Invalidate Caches / Restart... and chose the Invalidate/Restart option. Seems to have fixed the Out of Memory error.
Don't know if that will work for you at a later time, but hopefully it helps.
Good day.I have an set of buttons which should be aligned to the bottom always,but they all also should be below an text,and it goes like this,if text is large,it is going just to push the buttons inside the scrollview,otherwise the buttons should be aligned to the parent bottom.Issue is that i add both of the tags to the linear layout wrapper of the buttons,but as soon as i set visibility of text to gone,the view just pops up and not aligning to parent bottom,here is the actual code,
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/single_product_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/single_product_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:src="#drawable/img_placeholder" />
<RelativeLayout
android:id="#+id/basket_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/single_product_divider"
android:layout_alignEnd="#+id/single_product_divider"
android:layout_alignLeft="#+id/single_product_divider"
android:layout_alignParentTop="true"
android:layout_alignRight="#+id/single_product_divider"
android:layout_alignStart="#+id/single_product_divider"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:visibility="gone">
<ImageView
android:id="#+id/basket_success_icon"
android:layout_width="46dp"
android:layout_height="46dp"
android:layout_centerVertical="true"
android:layout_marginLeft="26dp"
android:src="#drawable/success_icon" />
<TextView
android:id="#+id/basket_product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/basket_success_icon"
android:layout_marginLeft="16dp"
android:layout_marginTop="5dp"
android:layout_toRightOf="#+id/basket_success_icon"
android:text="#string/product_added_to_basket_text"
android:textColor="#ffffff"
android:textSize="16sp" />
</RelativeLayout>
<View
android:id="#+id/single_product_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/single_product_image"
android:layout_margin="25dp"
android:background="#D1D3D4">
</View>
<TextView
android:id="#+id/single_product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/single_product_divider"
android:layout_alignStart="#+id/single_product_divider"
android:layout_below="#+id/single_product_divider"
android:text="#string/loading_text"
android:textColor="#231F20" />
<TextView
android:id="#+id/single_product_weight_and_servings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/single_product_divider"
android:layout_alignStart="#+id/single_product_divider"
android:layout_below="#+id/single_product_name"
android:layout_marginTop="5dp"
android:text="#string/weight_and_servings_text"
android:textColor="#231F20" />
<TextView
android:id="#+id/single_product_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/single_product_weight_and_servings"
android:layout_alignStart="#+id/single_product_weight_and_servings"
android:layout_below="#+id/single_product_weight_and_servings"
android:layout_marginTop="15dp"
android:text="$12.09"
android:textColor="#009444"
android:textSize="17sp"
android:textStyle="bold" />
<RatingBar
android:id="#+id/single_product_rating"
style="#style/Base.Widget.AppCompat.RatingBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/single_product_price"
android:layout_alignStart="#+id/single_product_price"
android:layout_below="#+id/single_product_price"
android:layout_marginTop="5dp"
android:numStars="5" />
<TextView
android:id="#+id/single_product_rating_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/single_product_rating"
android:layout_marginLeft="5dp"
android:layout_toRightOf="#+id/single_product_rating"
android:text="10.0/10"
android:textColor="#231F20"
android:textSize="12sp" />
<TextView
android:id="#+id/single_product_review_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/single_product_rating_text"
android:layout_marginLeft="5dp"
android:layout_toRightOf="#+id/single_product_rating_text"
android:text="8 reviews"
android:textColor="#EC2027"
android:textSize="12sp" />
<TextView
android:id="#+id/single_product_stock_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/single_product_review_count"
android:layout_marginRight="10dp"
android:text="In stock"
android:textColor="#939598" />
<View
android:id="#+id/single_product_center_divider"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_below="#+id/single_product_rating"
android:layout_centerHorizontal="true"></View>
<Spinner
android:id="#+id/single_product_weight_spinner"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/single_product_rating"
android:layout_marginLeft="10dp"
android:layout_marginRight="2dp"
android:layout_marginTop="10dp"
android:layout_toLeftOf="#+id/single_product_center_divider"
android:background="#drawable/spinner_background"
android:spinnerMode="dropdown"></Spinner>
<Spinner
android:id="#+id/single_product_type_spinner"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_below="#+id/single_product_rating"
android:layout_marginLeft="2dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/single_product_center_divider"
android:background="#drawable/spinner_background"
android:spinnerMode="dropdown"></Spinner>
<TextView
android:id="#+id/single_product_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/single_product_type_spinner"
android:layout_margin="16dp"
android:text="This is simply the best tripod for the money you\'ll ever buy,it\'s rock solid and the head alone is worth more then the asking price"
android:textColor="#231F20" />
<RelativeLayout
android:id="#+id/single_product_buttons_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="#+id/single_product_description"
android:orientation="vertical">
<Button
android:id="#+id/single_product_add_to_cart_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#F26522"
android:text="#string/add_to_cart_text"
android:textAllCaps="false"
android:textColor="#ffffff" />
<Button
android:id="#+id/single_product_info_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/single_product_add_to_cart_button"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="8dp"
android:background="#E7E8E9"
android:drawableRight="#drawable/ic_arrow_down"
android:paddingRight="10dp"
android:text="#string/product_info_text"
android:textAllCaps="false"
android:textColor="#231F20" />
<Button
android:id="#+id/single_product_nutritional_info_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/single_product_info_button"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="8dp"
android:background="#E7E8E9"
android:drawableRight="#drawable/ic_arrow_down"
android:paddingRight="10dp"
android:text="#string/product_nutritional_text"
android:textAllCaps="false"
android:textColor="#231F20" />
<Button
android:id="#+id/single_product_reviews_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/single_product_nutritional_info_button"
android:layout_marginBottom="5dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="8dp"
android:background="#E7E8E9"
android:drawableRight="#drawable/ic_arrow_down"
android:paddingRight="10dp"
android:text="#string/product_reviews_text"
android:textAllCaps="false"
android:textColor="#231F20" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
Can anyone please give any suggestion?
Edit : The full code of the view,actual buttons are inside RelativeLayout at the bottom of xml files there are 4 of buttons.The wrapper is single_product_buttons_wrapper
Add android:gravity="bottom" to LinearLayout containing buttons. It will work have tested it.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="#+id/single_product_description"
android:gravity="bottom"
android:orientation="vertical">
Try this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true">
<TextView
android:id="#+id/single_product_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="This is simply the best tripod for the money you\'ll ever buy,it\'s rock solid and the head alone is worth more then the asking price"
android:textColor="#231F20" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<Button
android:id="#+id/single_product_add_to_cart_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/single_product_info_button"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#F26522"
android:text="123"
android:textAllCaps="false"
android:textColor="#ffffff" />
<Button
android:id="#+id/single_product_info_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/single_product_nutritional_info_button"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="8dp"
android:background="#E7E8E9"
android:paddingRight="10dp"
android:text="234"
android:textAllCaps="false"
android:textColor="#231F20" />
<Button
android:id="#+id/single_product_nutritional_info_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/single_product_reviews_button"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="8dp"
android:background="#E7E8E9"
android:paddingRight="10dp"
android:text="5555"
android:textAllCaps="false"
android:textColor="#231F20" />
<Button
android:id="#+id/single_product_reviews_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="5dp"
android:layout_marginTop="8dp"
android:background="#E7E8E9"
android:paddingRight="10dp"
android:text="99999"
android:textAllCaps="false"
android:textColor="#231F20" />
</LinearLayout>
</RelativeLayout>
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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="#layout/toolbar"/>
<ScrollView
android:id="#+id/scroll"
android:layout_width="wrap_content"
android:layout_below="#+id/toolbar"
android:layout_height="wrap_content"
android:layout_above="#+id/makeOffer"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="#+id/firstcard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
android:layout_marginTop="#dimen/padding_8dp"
app:cardCornerRadius="#dimen/padding_4dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<RelativeLayout
android:id="#+id/insidecardone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="#dimen/padding_4dp">
<TextView
android:id="#+id/constant_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/padding_4dp"
android:text="Charge per day"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/tvRentPerday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:hint="Rs. "
android:gravity="center"
android:inputType="number"
android:maxLength="4"
android:textColor="#android:color/black"
android:textSize="#dimen/text_size_big_16" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/insidecardtwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardone"
android:layout_margin="#dimen/padding_4dp">
<TextView
android:id="#+id/con_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Duration (Days)"
android:textSize="#dimen/text_size_big_16" />
<TextView
android:id="#+id/num_days"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center_horizontal"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_24dp"
android:text="10"
android:textSize="#dimen/text_size_big_16"
/>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/insidecardtwo"
android:layout_margin="#dimen/padding_8dp"
android:background="#color/grey_lighter" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardtwo"
android:layout_margin="#dimen/padding_4dp"
android:paddingBottom="#dimen/padding_8dp"
android:paddingTop="#dimen/padding_24dp">
<TextView
android:id="#+id/total_constant"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="#dimen/padding_4dp"
android:gravity="center_vertical"
android:text="Total Amount"
android:textSize="#dimen/text_size_big_16" />
<TextView
android:id="#+id/tvAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:textColor="#ff4f00"
android:textSize="#dimen/text_size_big_16"
android:textStyle="bold" />
<TextView
android:id="#+id/total_constant_mutterfly"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/total_constant"
android:paddingTop="#dimen/padding_4dp"
android:text="#string/process_fee_text"
android:textColor="#android:color/darker_gray"
android:textSize="8sp" />
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/middlecard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/firstcard"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
app:cardCornerRadius="#dimen/padding_4dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<RelativeLayout
android:id="#+id/middlecard_relative"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="#dimen/padding_4dp">
<TextView
android:id="#+id/deposite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="#dimen/padding_4dp"
android:gravity="center_vertical"
android:text="Deposit"
android:textSize="#dimen/text_size_big_16" />
<TextView
android:id="#+id/knowmore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/deposite"
android:text="#string/txt_know_more"
android:layout_marginTop="#dimen/padding_8dp"
android:textSize="#dimen/text_size_extra_extra_small_10"
/>
<CheckBox
android:id="#+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:inputType="number"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_16dp"
android:textColor="#android:color/black"
android:textSize="#dimen/text_size_big_16" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/middletwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/middlecard_relative"
android:layout_margin="#dimen/padding_4dp"
android:visibility="gone"
>
<TextView
android:id="#+id/middle_con_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Charge (Rs.)"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/etDeposit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_16dp"
android:hint="1000"
android:maxLength="4"
android:inputType="number"
android:textSize="#dimen/text_size_big_16"
/>
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/seccard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/middlecard"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
app:cardCornerRadius="#dimen/padding_4dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="#+id/describe_constant_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="#dimen/padding_8dp"
android:text="Describe Your item"
android:textColor="#ff4f00"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/rlTohide"
android:layout_marginTop="#dimen/padding_4dp"
android:layout_width="160dp"
android:layout_height="120dp"
android:background="#drawable/greyborder_transparentbg"
>
<ImageView
android:id="#+id/img1"
android:layout_centerInParent="true"
android:layout_width="40dp"
android:src="#drawable/addimg"
android:layout_height="40dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/img1"
android:text="(Optional)"
android:textSize="#dimen/text_size_extra_extra_small_10"
android:textColor="#color/text_grey_opc"
android:layout_centerInParent="true"
/>
</RelativeLayout>
<ImageView
android:visibility="gone"
android:id="#+id/imgResource"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_gravity="center"
android:layout_marginTop="#dimen/padding_8dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
android:layout_marginTop="180dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardone"
android:layout_margin="#dimen/padding_4dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<TextView
android:id="#+id/con_product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="8dp"
android:text="Name Of Product"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_toEndOf="#+id/con_product_name"
android:layout_toRightOf="#+id/con_product_name"
android:layout_alignParentRight="true"
android:hint="E.g. Nikon DSLR"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_16dp"
android:maxLength="30"
android:inputType="textPersonName"
android:layout_marginLeft="#dimen/padding_16dp"
android:layout_marginStart="#dimen/padding_16dp"
android:textColor="#android:color/black"
android:textSize="#dimen/text_size_big_16"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardtwo"
android:layout_margin="#dimen/padding_4dp"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<TextView
android:id="#+id/Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Description :"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/desc_box"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/Description"
android:hint="E.g. Comes with 18-55 mm lens, charger and carry case"
android:layout_marginTop="#dimen/padding_8dp"
android:background="#drawable/white_border_request_screen"
android:textColor="#android:color/darker_gray"
android:textSize="#dimen/text_size_big_16" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
</ScrollView>
<Button
android:id="#+id/makeOffer"
android:layout_width="match_parent"
android:layout_height="#dimen/padding_48dp"
android:layout_alignParentBottom="true"
android:background="#color/new_primary_text"
android:padding="#dimen/padding_8dp"
android:text="#string/txt_make_offr"
android:textColor="#android:color/white"
android:textSize="#dimen/text_size_18"
/>
</RelativeLayout>
Android Manifest
<activity
android:name=".MyActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"/>
I am working on the layout since last night and I tried almost solution which I known. I am new in Android so please suggest me what is wrong with this layout.
this "fillViewport" work for another screen but with this screen it's not working.
Add android:windowSoftInputMode="stateHidden|adjustResize" to your <activity> tag in AndroidManifest.xml file. This will cause the screen to be resized to the left over space after the soft keyboard is shown. So, you will be able to scroll easily.
One more thing set property of ScrollView to the android:layout_above to the Button on the bottom of the page.
UpDate :
add this line to your ScrollView.
android:layout_above="#+id/makeOffer"
like this way
<ScrollView
android:id="#+id/scroll"
android:layout_width="wrap_content"
android:layout_below="#+id/toolbar"
android:layout_height="wrap_content"
android:fillViewport="true"
android:layout_above="#+id/makeOffer">
ScreenShot :
So I have a layout that I'm working on, and just to make sure everything is looking OK on an actual phone I'm doing a test run before I move on with the other labels. But, the problem is, Eclipse can only find one id contactName. The other id's all have an error saying that Android can't find them. My XML File is below:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/contactPicture"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="31dp"
android:layout_marginTop="34dp"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/nameLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/contactPicture"
android:layout_marginLeft="30dp"
android:layout_toRightOf="#+id/contactPicture"
android:text="#string/name"
android:textSize="16sp"/>
<TextView
android:id="#+id/contactName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/nameLabel"
android:layout_below="#+id/nameLabel"
android:text="TextView"
android:textSize="20sp" />
<TextView
android:id="#+id/companyLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/companyName"
android:layout_alignLeft="#+id/companyName"
android:text="#string/company"
android:textSize="16sp" />
<TextView
android:id="#+id/companyName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/contactPicture"
android:layout_alignLeft="#+id/contactName"
android:text="TextView"
android:textSize="20sp" />
<TextView
android:id="#+id/phoneLabel"
android:text="Phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/contactPicture"
android:layout_alignLeft="#+id/contactPicture"
android:layout_marginTop="30sp"
android:textSize="16sp"/>
<TextView
android:id="#+id/workNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Work Num"
android:textSize="20sp"
android:layout_below="#+id/phoneLabel"
android:layout_alignLeft="#+id/phoneLabel" />
<TextView
android:id="#+id/homeNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home Num"
android:textSize="20sp"
android:layout_below="#+id/workNum"
android:layout_alignLeft="#+id/workNum" />
<TextView
android:id="#+id/mobileNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile Num"
android:textSize="20sp"
android:layout_below="#+id/homeNum"
android:layout_alignLeft="#+id/homeNum" />
<TextView
android:id="#+id/workLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Work"
android:textSize="20sp"
android:layout_toRightOf="#+id/workNum"
android:layout_alignTop="#+id/workNum"
android:layout_marginLeft="120sp" />
<TextView
android:id="#+id/homeLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home"
android:textSize="20sp"
android:layout_below="#+id/workLabel"
android:layout_alignLeft="#+id/workLabel" />
<TextView
android:id="#+id/mobileLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile"
android:textSize="20sp"
android:layout_below="#+id/homeLabel"
android:layout_alignLeft="#+id/workLabel" />
</RelativeLayout>
</ScrollView>