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>
Related
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>
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>
Whenever i run the app i get this error. I have tried all the solutions online but all of them failed.
Any help?
<?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">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dishname"
android:id="#+id/item_name"
android:textSize="24dp"
android:textColor="#396fd1"
android:layout_alignParentTop="true"
android:layout_alignStart="#+id/item_type" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="price"
android:id="#+id/item_price"
android:textSize="16dp"
android:layout_below="#+id/item_name"
android:layout_toEndOf="#+id/item_name"
android:layout_marginStart="32dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="type"
android:id="#+id/item_type"
android:textSize="12dp"
android:layout_below="#+id/item_name"
android:layout_alignStart="#+id/item_nofingredients" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#"
android:id="#+id/item_nofingredients"
android:textSize="12dp"
android:layout_below="#+id/item_type"
android:layout_alignParentStart="true"
android:layout_marginStart="15dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ingredients"
android:id="#+id/textView5"
android:textSize="12dp"
android:layout_below="#+id/item_type"
android:layout_toEndOf="#+id/item_type" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/deleteButton"
android:layout_alignBottom="#+id/item_price"
android:layout_alignParentEnd="true"
android:layout_marginEnd="19dp"
android:background="#android:color/transparent"
android:src="#android:drawable/ic_menu_delete"/>
</RelativeLayout>
You have 11 invisible vertical tab characters in your XML, the first one at the end of row #4. Vertical tabs are not valid whitespace characters in XML.
Android Studio does not display the vertical tabs. You can use an editor like Sublime Text to see them.
I edited for you.You can copy it.
<?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">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dishname"
android:id="#+id/item_name"
android:textSize="24dp"
android:textColor="#396fd1"
android:layout_alignParentTop="true"
android:layout_alignStart="#+id/item_type" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="price"
android:id="#+id/item_price"
android:textSize="16dp"
android:layout_below="#+id/item_name"
android:layout_toEndOf="#+id/item_name"
android:layout_marginStart="32dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="type"
android:id="#+id/item_type"
android:textSize="12dp"
android:layout_below="#+id/item_name"
android:layout_alignStart="#+id/item_nofingredients" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#"
android:id="#+id/item_nofingredients"
android:textSize="12dp"
android:layout_below="#+id/item_type"
android:layout_alignParentStart="true"
android:layout_marginStart="15dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ingredients"
android:id="#+id/textView5"
android:textSize="12dp"
android:layout_below="#+id/item_type"
android:layout_toEndOf="#+id/item_type" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/deleteButton"
android:layout_alignBottom="#+id/item_price"
android:layout_alignParentEnd="true"
android:layout_marginEnd="19dp"
android:background="#android:color/transparent"
android:src="#android:drawable/ic_menu_delete"/>
</RelativeLayout>
I am going through a peculiar problem. I have multiple EditText inside a RelativeLayout which is ultimately inside a ScrollView. My problem is that whenever I edit the second(or third and so on) EditText, it loses focus to the first EditText inside the ScrollView and this first EditText gets the keyboard input.
Here goes the xml layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="#+id/parentLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="#+id/particularsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_marginTop="50dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp">
<TextView
android:id="#+id/particularsTextView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PARTICULARS"
android:textColor="#android:color/darker_gray"
android:textStyle="bold"
/>
<View
android:id="#+id/bar1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray"
android:layout_below="#+id/particularsTextView"
/>
<RelativeLayout
android:id="#+id/particularsParentRelativeLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/bar1"
android:layout_marginTop="10dp"
>
<EditText
android:id="#+id/nameEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="15dp"
android:layout_alignLeft="#+id/confirmPasswordEditText"
/>
<TextView
android:id="#+id/nameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NAME"
android:textColor="#android:color/darker_gray"
android:textStyle="bold"
android:layout_alignBottom="#+id/nameEditText"
android:layout_marginBottom="15dp"
android:textSize="12sp"
/>
<TextView
android:id="#+id/passwordTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PASSWORD"
android:textColor="#android:color/darker_gray"
android:textStyle="bold"
android:layout_alignBottom="#+id/passwordEditText"
android:layout_marginBottom="15dp"
android:textSize="12sp"
/>
<EditText
android:id="#+id/passwordEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/nameEditText"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/passwordTextView"
android:layout_alignParentRight="true"
android:nextFocusUp="#+id/passwordEditText"
android:layout_alignLeft="#+id/confirmPasswordEditText"
/>
<TextView
android:id="#+id/confirmPasswordTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CONFIRM PASSWORD"
android:textColor="#android:color/darker_gray"
android:textStyle="bold"
android:layout_alignBottom="#+id/confirmPasswordEditText"
android:layout_marginBottom="15dp"
android:textSize="12sp"
/>
<EditText
android:id="#+id/confirmPasswordEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/passwordEditText"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/confirmPasswordTextView"
android:layout_alignParentRight="true"
android:layout_marginLeft="5dp"
/>
<TextView
android:id="#+id/birthdayTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BIRTHDAY"
android:textColor="#android:color/darker_gray"
android:textStyle="bold"
android:layout_alignBottom="#+id/birthdayEditText"
android:layout_marginBottom="15dp"
android:textSize="12sp"
/>
<EditText
android:id="#+id/birthdayEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/confirmPasswordEditText"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/birthdayTextView"
android:layout_alignParentRight="true"
android:layout_alignLeft="#+id/confirmPasswordEditText"
/>
<TextView
android:id="#+id/genderTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GENDER"
android:textColor="#android:color/darker_gray"
android:textStyle="bold"
android:layout_marginTop="18dp"
android:layout_below="#+id/birthdayTextView"
android:textSize="12sp"
/>
<TextView
android:id="#+id/contactDetailsTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/genderTextView"
android:text="CONTACT DETAILS"
android:textColor="#android:color/darker_gray"
android:textStyle="bold"
android:layout_marginTop="50dp"
/>
<View
android:id="#+id/bar2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/darker_gray"
android:layout_below="#+id/contactDetailsTextView"
/>
<TextView
android:id="#+id/contactNoTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/contactNoEditText"
android:layout_marginBottom="15dp"
android:text="CONTACT NO."
android:textSize="12sp"
android:textColor="#android:color/darker_gray"
android:textStyle="bold"
/>
<EditText
android:id="#+id/contactNoEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/bar2"
android:layout_marginTop="15dp"
android:layout_alignParentRight="true"
android:layout_alignLeft="#+id/confirmPasswordEditText"
/>
<TextView
android:id="#+id/emailAddressTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="EMAIL AD."
android:textColor="#android:color/darker_gray"
android:textStyle="bold"
android:layout_alignBottom="#+id/emailAddressEditText"
android:layout_marginBottom="15dp"
android:textSize="12sp"
/>
<EditText
android:id="#+id/emailAddressEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/contactNoEditText"
android:layout_marginTop="10dp"
android:layout_alignParentRight="true"
android:layout_alignLeft="#+id/confirmPasswordEditText"
/>
<EditText
android:id="#+id/emailAddressEditText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/emailAddressTextView"
android:layout_marginTop="10dp"
android:layout_alignParentRight="true"
android:layout_alignLeft="#+id/confirmPasswordEditText"
/>
<TextView
android:id="#+id/countryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="COUNTRY"
android:textColor="#android:color/darker_gray"
android:textStyle="bold"
android:layout_below="#+id/emailAddressEditText2"
android:layout_marginTop="18dp"
android:textSize="12sp"
/>
<CheckBox
android:id="#+id/termsCheckbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/countryTextView" />
<TextView
android:id="#+id/termsTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/termsCheckbox"
android:layout_alignBottom="#+id/termsCheckbox"
android:text="I AGREE TO THE TERMS AND CONDITIONS STATED"
android:textColor="#android:color/darker_gray"
android:layout_alignBaseline="#+id/termsCheckbox"
/>
<Button
android:id="#+id/signupButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/termsTextView"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="#drawable/signup"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp"
/>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
How to resolve this issue ?
EDIT:
I have attached a screenshot of my problem. I have entered "h" in the passwordEditText but nameEditText gets the value.
mTabHost.addOnAttachStateChangeListener(new OnAttachStateChangeListener() {
#Override
public void onViewDetachedFromWindow(View v) {}
#Override
public void onViewAttachedToWindow(View v) {
mTabHost.getViewTreeObserver().removeOnTouchModeChangeListener(mTabHost);
}
});
Add this code in MainActivity.Java #setTabs() function after
mTabHost.setup(this, getSupportFragmentManager(), android.R.id.tabcontent);
this line.
Best of luck.
You can set focus to desired edit text after you make the change: ex.
myEditText3.setFocusableInTouchMode(true);
myEditText3.requestFocus();
It's Working in my device.
I don't know why it's not working in yours, I think in java code, there may be some error.
But you can try,
<RelativeLayout
android:id="#+id/parentLayout"
android:layout_width="match_parent"
android:focusableInTouchMode="true"
android:layout_height="match_parent" >
add 3rd line to your "parentLayout"
I want to create a listview like older gmail app. See the screenshot:
I tried putting an empty view like this:
<TextView
android:id="#+id/color_highlight"
android:layout_width="5dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="#ff0000"
android:minHeight="48dp" />
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:layout_toLeftOf="#id/color_highlight"
android:text="Mudit Agarwal"
android:textStyle="bold"
android:textColor="#242424"
android:textIsSelectable="false"
android:textSize="22sp" />
<TextView
android:id="#+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#id/name"
android:layout_below="#id/name"
android:text="9933445566"
android:textColor="#777777"
android:textIsSelectable="false"
android:layout_marginBottom="10dp"
android:textSize="15sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:padding="3dp"
android:src="#drawable/contact" />
but this is not taking full height of the view. Please suggest.
What I changed is
android:layout_alignBottom="#+id/number"
to your color_highlight TextView. and instead of margin, I put padding like below in number TextView.
android:paddingBottom="20dp"
just put following layout code.
<?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="wrap_content" >
<TextView
android:id="#+id/color_highlight"
android:layout_width="5dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignBottom="#+id/number"
android:background="#ff0000"
android:minHeight="48dp" />
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:layout_toLeftOf="#id/color_highlight"
android:text="Mudit Agarwal"
android:textColor="#242424"
android:textIsSelectable="false"
android:textSize="22sp"
android:textStyle="bold" />
<TextView
android:id="#+id/number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#id/name"
android:layout_below="#id/name"
android:paddingBottom="20dp"
android:text="9933445566"
android:textColor="#777777"
android:textIsSelectable="false"
android:textSize="15sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:padding="3dp"
android:src="#drawable/contact" />
</RelativeLayout>
I'm not sure but you can try putting android:layout_height="0dip" instead of android:layout_height="match_parent".