I have a App with Login Layout So I have added 2 Buttons Save,Cancel
this is my XML Layout
<?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:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#303F9F"
android:layout_alignParentTop="true"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="My App Login"
android:id="#+id/ota"
android:textColor="#FFF"
android:textStyle="bold"
android:layout_gravity="center_horizontal"/>
</RelativeLayout>
<ScrollView
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_above="#id/footer"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:layout_below="#id/header">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView android:textAppearance="?android:textAppearanceSmall"
android:gravity="bottom|left|center"
android:id="#+id/tt5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="#string/ui"
android:textSize="14sp"
android:layout_below="#+id/et3"
android:layout_weight="0.1"
android:layout_marginTop="10dp"/>
<EditText android:id="#+id/et4"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_marginLeft="5.0dip"
android:layout_marginBottom="5.0dip"
android:maxLines="1"
android:hint="Enter User Name"
android:layout_weight="0.1"
android:layout_below="#+id/tt5"
android:inputType="text"/>
<TextView android:textAppearance="?android:textAppearanceSmall"
android:gravity="bottom|left|center"
android:id="#+id/tt6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="#string/pw"
android:textSize="14sp"
android:layout_below="#+id/et4"
android:layout_weight="0.1"
android:layout_marginTop="10dp"/>
<EditText android:id="#+id/et5"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_marginLeft="5.0dip"
android:layout_marginBottom="5.0dip"
android:maxLines="1"
android:hint="Enter Password"
android:layout_weight="0.1"
android:layout_below="#+id/tt6"
android:inputType="textPassword"/>
<Button android:id="#+id/save"
android:layout_width="fill_parent"
android:layout_height="0.0dip"
android:layout_marginBottom="5.0dip"
android:text="#string/save"
android:textAlignment="center"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Large"
android:background="#drawable/selector_btn"
android:drawableLeft="#android:drawable/ic_menu_save"
android:layout_weight="0.1"
android:layout_marginTop="50dp"
android:textColor="#color/text_white"/>
<Button android:id="#+id/cancel"
android:layout_width="fill_parent"
android:layout_height="0.0dip"
android:text="#string/cancel"
android:textAlignment="center"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Large"
android:background="#drawable/c_selector_btn"
android:drawableLeft="#android:drawable/ic_menu_close_clear_cancel"
android:layout_weight="0.1"
android:textColor="#color/text_white"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Here its working fine for android 5,6 but in android 7 buttons are not showing in emulator,xml,Real Device
But its not working in android 7
its showing like this
can any one suggest me what I am missing for android 7 in android XML.. I am using same in android 5,6 its worked but its not showing in 7
<Button android:id="#+id/save"
android:layout_width="match_parenr"
android:layout_height="wrap_content"
android:layout_marginBottom="5.0dip"
android:text="#string/save"
android:textAlignment="center"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Large"
android:background="#drawable/selector_btn"
android:drawableLeft="#android:drawable/ic_menu_save"
android:layout_marginTop="50dp"
android:textColor="#color/text_white"/>
You should give height of button to wrap_content
You can try bellow like..
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<!--Header Hear-->
<!-- Content Here -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight=".1"
android:background="#FFFFFF"
android:orientation="vertical" >
<TextView
android:id="#+id/tv_message_reset_new_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp" />
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView android:textAppearance="?android:textAppearanceSmall"
android:gravity="bottom|left|center"
android:id="#+id/tt5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="User Id"
android:textSize="14sp"
android:layout_below="#+id/et3"
android:layout_weight="0.1"
android:layout_marginTop="10dp"/>
<EditText android:id="#+id/et4"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_marginLeft="5.0dip"
android:layout_marginBottom="5.0dip"
android:maxLines="1"
android:hint="Enter User Name"
android:layout_weight="0.1"
android:layout_below="#+id/tt5"
android:inputType="text"/>
<TextView android:textAppearance="?android:textAppearanceSmall"
android:gravity="bottom|left|center"
android:id="#+id/tt6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="password"
android:textSize="14sp"
android:layout_below="#+id/et4"
android:layout_weight="0.1"
android:layout_marginTop="10dp"/>
<EditText android:id="#+id/et5"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_marginLeft="5.0dip"
android:layout_marginBottom="5.0dip"
android:maxLines="1"
android:hint="Enter Password"
android:layout_weight="0.1"
android:layout_below="#+id/tt6"
android:inputType="textPassword"/>
<Button android:id="#+id/save"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5.0dip"
android:text="save"
android:textAlignment="center"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Large"
android:background="#97d1ea"
android:drawableLeft="#android:drawable/ic_menu_save"
android:layout_weight="0.1"
android:layout_marginTop="50dp"
android:textColor="#ffffff"/>
<Button android:id="#+id/cancel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="cancel"
android:textAlignment="center"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Large"
android:background="#97d1ea"
android:drawableLeft="#android:drawable/ic_menu_close_clear_cancel"
android:layout_weight="0.1"
android:textColor="#ffffff"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
<!--Footer Hear-->
</LinearLayout>
Related
I saw so many people ask the same question in here, but I still cannot find the reason why my scrollview doesn't work.
Here is my Layout
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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/activity_upload"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:fillViewport="true"
tools:context="com.example.daniw.traekle.upload">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="#+id/tv_itemName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item Name"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginBottom="5dp"/>
<EditText
android:id="#+id/et_itemTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Title"
android:layout_marginBottom="5dp"
android:textColor="#000000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="Book ISBN(option)"
android:id="#+id/tv_bISBN"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="#000000" />
<EditText
android:id="#+id/et_ISBN"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:textColor="#000000"
android:text="test"/>
<TextView
android:id="#+id/tv_itemPrice"
android:text="Price"
android:textStyle="bold"
android:textSize="20sp"
android:textColor="#000000"
android:layout_marginBottom="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/et_itemPrice"
android:text="Test"
android:textColor="#000000"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"/>
<TextView
android:id="#+id/tv_itemDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item Description"
android:textSize="20sp"
android:textColor="#000000"
android:textStyle="bold"
android:layout_marginBottom="5dp"/>
<android.support.design.widget.TextInputLayout
android:id="#+id/inputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:counterEnabled="true"
app:counterMaxLength="600"
app:counterOverflowTextAppearance="#style/MyOverflowText">
<EditText
android:id="#+id/et_itemDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:text="Test"
android:maxLength="600"
android:textColor="#000000"/>
</android.support.design.widget.TextInputLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Choose Image"
android:id="#+id/b_chooseImage"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="#+id/itemImage"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Post Item"
android:id="#+id/bPost"/>
</LinearLayout>
</ScrollView>
That is so weird, because I finished other layout use the scrollview it's work fine, but in this activity the scrollview doesn't even show in preview.
There no scroll
You have your LinearLayout height set to fill_parent which is deprecated but is the same thing is match_parent instead your LinearLayout height should be set to wrap_content.
The reason is that your LinearLayout has the same exact height as the ScrollView so there is no need to scroll. If you set it to wrap_content the LinearLayout can have a height larger then the ScrollView which will scroll to show what is outside of ScrollViews bounds
Try this:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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/activity_upload"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:fillViewport="true"
tools:context="com.example.daniw.traekle.upload">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tv_itemName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item Name"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginBottom="5dp"/>
<EditText
android:id="#+id/et_itemTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Title"
android:layout_marginBottom="5dp"
android:textColor="#000000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="Book ISBN(option)"
android:id="#+id/tv_bISBN"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="#000000" />
<EditText
android:id="#+id/et_ISBN"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:textColor="#000000"
android:text="test"/>
<TextView
android:id="#+id/tv_itemPrice"
android:text="Price"
android:textStyle="bold"
android:textSize="20sp"
android:textColor="#000000"
android:layout_marginBottom="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/et_itemPrice"
android:text="Test"
android:textColor="#000000"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"/>
<TextView
android:id="#+id/tv_itemDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item Description"
android:textSize="20sp"
android:textColor="#000000"
android:textStyle="bold"
android:layout_marginBottom="5dp"/>
<android.support.design.widget.TextInputLayout
android:id="#+id/inputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:counterEnabled="true"
app:counterMaxLength="600"
app:counterOverflowTextAppearance="#style/MyOverflowText">
<EditText
android:id="#+id/et_itemDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:text="Test"
android:maxLength="600"
android:textColor="#000000"/>
</android.support.design.widget.TextInputLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Choose Image"
android:id="#+id/b_chooseImage"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_margin="5dp"
android:paddingBottom="16dp"
android:scaleType="fitXY"
android:id="#+id/itemImage"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Post Item"
android:id="#+id/bPost"/>
</LinearLayout>
</ScrollView>
Just realize how stupid am I , i finish fixed this problem.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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/activity_upload"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:fillViewport="true"
tools:context="com.example.daniw.traekle.upload">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Choose Image"
android:id="#+id/b_chooseImage"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="200dp"
android:layout_margin="5dp"
android:layout_marginBottom="5dp"
android:paddingBottom="50dp"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:paddingTop="3dp"
android:scaleType="fitXY"
android:id="#+id/itemImage"/>
<TextView
android:id="#+id/tv_itemName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item Name"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_marginBottom="5dp"/>
<EditText
android:id="#+id/et_itemTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Title"
android:layout_marginBottom="5dp"
android:textColor="#000000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="Book ISBN(option)"
android:id="#+id/tv_bISBN"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="#000000" />
<EditText
android:id="#+id/et_ISBN"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:textColor="#000000"
android:text="test"/>
<TextView
android:id="#+id/tv_itemPrice"
android:text="Price"
android:textStyle="bold"
android:textSize="20sp"
android:textColor="#000000"
android:layout_marginBottom="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="#+id/et_itemPrice"
android:text="Test"
android:textColor="#000000"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"/>
<TextView
android:id="#+id/tv_itemDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item Description"
android:textSize="20sp"
android:textColor="#000000"
android:textStyle="bold"
android:layout_marginBottom="5dp"/>
<android.support.design.widget.TextInputLayout
android:id="#+id/inputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:counterEnabled="true"
app:counterMaxLength="600"
app:counterOverflowTextAppearance="#style/MyOverflowText">
<EditText
android:id="#+id/et_itemDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:text="Test"
android:maxLength="600"
android:textColor="#000000"/>
</android.support.design.widget.TextInputLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Post Item"
android:id="#+id/bPost"/>
</LinearLayout>
</ScrollView>
Now this layout working fine
Can anybody tell me why this ScrollView is not working? I checked the other answers for this question and it hasn't solved my problem. It has just one child. It has a closing bracket. Any ideas? Thanks in advance
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#89abe3"
tools:context=".GardaLoginActivity" >
<RelativeLayout
android:layout_width="match_parent" android:layout_height="match_parent"
android:focusableInTouchMode="true" android:fitsSystemWindows="true"
android:background="#89abe3">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Smart Neighborhood Watch"
android:id="#+id/Logo"
android:textSize="40dp"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:textColor="#ffdd00"
android:textStyle="bold"/>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/Logo"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<TextView
android:id="#+id/lblGardaEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Email"
android:textColor="#FFFFFF"/>
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout1"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp">
<EditText
android:id="#+id/txtGardaEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="textEmailAddress"
android:textColor="#FFFFFF"/>
<requestFocus />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout2"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp">
<TextView
android:id="#+id/lblGardaPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/password"
android:textColor="#FFFFFF"/>
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout3"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp">
<EditText
android:id="#+id/txtGardaPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColorHint="#cccccc"
android:hint="Minimum 7 characters"
android:inputType="textPassword"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout4"
android:layout_centerHorizontal="true"
android:paddingTop="30dp"
android:gravity="center"
android:weightSum="1">
<Button
android:id="#+id/btnGardaLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/login"
android:background="#66c2ff"
android:textColor="#FFFFFF"
android:layout_weight="0.30" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout5"
android:layout_centerHorizontal="true"
android:paddingTop="10dp"
android:gravity="center"
>
<TextView
android:id="#+id/textViewGardaRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Not a member? Register"
android:paddingTop="10dp"
android:textColor="#FFFFFF" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
Sorry that i wrote this as an awnser as I can't comment on questions.
If your layout is bigger than your screen the scrollview will work.
And One more thing Child layout of ScrollView's height wrap_content
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#89abe3"
tools:context=".GardaLoginActivity" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:fitsSystemWindows="true"
android:background="#89abe3">
//Your Code
</RelativeLayout>
</ScrollView>
just Change your child Relative layout to
<RelativeLayout
android:layout_width="match_parent" android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:background="#89abe3">
as the relative layouts android:fitsSystemWindows="true" attribute is using whole screen there is no room for ScrollView to scroll.
Important Note :
According to Android guidelines, android:layout_height attribute of
the first (and only) ScrollView children should always be
"wrap_content". You will get a Lint warning if you use match_parent
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
with this code:
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#89abe3"
tools:context=".GardaLoginActivity" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#89abe3"
android:fitsSystemWindows="true"
android:focusableInTouchMode="true" >
<TextView
android:id="#+id/Logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="35dp"
android:gravity="center"
android:text="Smart Neighborhood Watch"
android:textColor="#ffdd00"
android:textSize="40dp"
android:textStyle="bold" />
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/Logo"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<TextView
android:id="#+id/lblGardaEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Email"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout1"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<EditText
android:id="#+id/txtGardaEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="textEmailAddress"
android:textColor="#FFFFFF" />
<requestFocus />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout2"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<TextView
android:id="#+id/lblGardaPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout3"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<EditText
android:id="#+id/txtGardaPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Minimum 7 characters"
android:inputType="textPassword"
android:textColor="#FFFFFF"
android:textColorHint="#cccccc" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout4"
android:layout_centerHorizontal="true"
android:gravity="center"
android:paddingTop="30dp"
android:weightSum="1" >
<Button
android:id="#+id/btnGardaLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.30"
android:background="#66c2ff"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout5"
android:layout_centerHorizontal="true"
android:gravity="center"
android:paddingTop="10dp" >
<TextView
android:id="#+id/textViewGardaRegister"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:text="Not a member? Register"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout6"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<EditText
android:id="#+id/edt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Minimum 7 characters"
android:inputType="textPassword"
android:textColor="#FFFFFF"
android:textColorHint="#cccccc" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout7"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<EditText
android:id="#+id/edt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Minimum 7 characters"
android:inputType="textPassword"
android:textColor="#FFFFFF"
android:textColorHint="#cccccc" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout8"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<EditText
android:id="#+id/edt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Minimum 7 characters"
android:inputType="textPassword"
android:textColor="#FFFFFF"
android:textColorHint="#cccccc" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout9"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<EditText
android:id="#+id/edt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Minimum 7 characters"
android:inputType="textPassword"
android:textColor="#FFFFFF"
android:textColorHint="#cccccc" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout11"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout10"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<EditText
android:id="#+id/edt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Minimum 7 characters"
android:inputType="textPassword"
android:textColor="#FFFFFF"
android:textColorHint="#cccccc" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout12"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout11"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<EditText
android:id="#+id/edt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Minimum 7 characters"
android:inputType="textPassword"
android:textColor="#FFFFFF"
android:textColorHint="#cccccc" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout13"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout12"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<EditText
android:id="#+id/edt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Minimum 7 characters"
android:inputType="textPassword"
android:textColor="#FFFFFF"
android:textColorHint="#cccccc" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout13"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<EditText
android:id="#+id/edt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Minimum 7 characters"
android:inputType="textPassword"
android:textColor="#FFFFFF"
android:textColorHint="#cccccc" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout15"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout14"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<EditText
android:id="#+id/edt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Minimum 7 characters"
android:inputType="textPassword"
android:textColor="#FFFFFF"
android:textColorHint="#cccccc" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout16"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout15"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<EditText
android:id="#+id/edt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Minimum 7 characters"
android:inputType="textPassword"
android:textColor="#FFFFFF"
android:textColorHint="#cccccc" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout17"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout16"
android:layout_centerHorizontal="true"
android:layout_marginTop="17dp" >
<EditText
android:id="#+id/edt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Minimum 7 characters"
android:inputType="textPassword"
android:textColor="#FFFFFF"
/>
</LinearLayout>
</RelativeLayout>
</ScrollView>
I have checked your code. It's working perfectly even with scroll.
Do you have any other doubt?
Hi in the below xml using drawable i was added frame.Now,for single one I am displaying personal information In the same way how to display multiple but title should be different.
How do that one any one can help me.
updated
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/frame1">
<RelativeLayout
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="#android:color/white">
<!-- This is the main content -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="280dp"
android:layout_margin="15dp"
android:background="#drawable/frame1"
android:orientation="vertical"
android:padding="20dp" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center|center_vertical"
android:background="#DFECEB"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginTop="20dp"
android:padding="5dp"
android:text="First Name:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="15sp"
android:textStyle="bold" />
<EditText
android:id="#+id/first_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:background="#drawable/rounded"
android:cursorVisible="true"
android:padding="5dp"
android:singleLine="true"
android:textColor="#000000" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginTop="10dp"
android:padding="5dp"
android:text="Last Name:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp"
android:textStyle="bold" />
<EditText
android:id="#+id/last_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:background="#drawable/rounded"
android:cursorVisible="true"
android:inputType="textPassword"
android:padding="5dp"
android:singleLine="true"
android:textColor="#000000" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginTop="10dp"
android:padding="5dp"
android:text="Email:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp"
android:textStyle="bold" />
<EditText
android:id="#+id/email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:background="#drawable/rounded"
android:cursorVisible="true"
android:inputType="textPassword"
android:padding="5dp"
android:singleLine="true"
android:textColor="#000000" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginTop="10dp"
android:padding="5dp"
android:text="Mobile No."
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp"
android:textStyle="bold" />
<EditText
android:id="#+id/mobile_no"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:background="#drawable/rounded"
android:cursorVisible="true"
android:inputType="textPassword"
android:padding="5dp"
android:singleLine="true"
android:textColor="#000000" >
</EditText>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<!-- This is the title label -->
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="#android:color/white" android:padding="5dp"
android:text="Personal Information"
android:layout_marginLeft="30dp" android:textColor="#android:color/black" />
</RelativeLayout>
</FrameLayout>
</LinearLayout>
Am not 100% sure , what you are asking. If my understanding is correct, you want to wrap the frame . If so, try editing your Relative layouts height to Wrapcontent.
<RelativeLayout
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_margin="5dp" android:background="#drawable/frame1"
android:orientation="vertical" android:padding="5dp">
So I've completed an early version of my Android app and begun testing on various devices. I'm finding my nested LinearLayouts aren't sufficient for my purposes so I'm trying to convert the nested LinearLayouts to a RelativeLayout. Below is my starting point:
<?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:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
tools:context=".LoginActivity">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/backgroundhomescreen"
android:scaleType="fitXY" />
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="35dp">
<LinearLayout
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:paddingBottom="3dp"
android:layout_marginBottom="10dp">
<EditText
android:id="#+id/login_txt_Username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#layout/textboxlogin"
android:hint="Username or Email"
android:inputType="textEmailAddress"
android:scrollbars="none"
android:textColor="#fff"
android:textColorHint="#ddd" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:paddingBottom="3dp"
android:paddingTop="3dp"
android:layout_marginBottom="10dp">
<EditText
android:id="#+id/login_txt_Password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#layout/textboxlogin"
android:hint="Password"
android:inputType="textPassword"
android:maxLines="1"
android:textColorHint="#ddd" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:paddingBottom="3dp"
android:paddingTop="3dp">
<Button
android:id="#+id/login_btn_submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="SIGN IN"
android:textColor="#fff"
android:textSize="25dp"
android:textStyle="bold"
android:typeface="normal"
android:background="#layout/buttonsigninbackground" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:paddingBottom="10dp"
android:paddingTop="3dp">
<TextView
android:id="#+id/login_txt_or"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="- or -"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="25dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:paddingBottom="15dp"
android:paddingTop="3dp">
<Button
android:id="#+id/login_btn_navCreateAccount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#layout/buttoncreateaccountbackground"
android:text="CREATE AN ACCOUNT"
android:textColor="#fff"
android:textSize="25dp"
android:textStyle="bold"
android:typeface="normal" />
</LinearLayout>
</LinearLayout>
</TableLayout>
</RelativeLayout>
And here is where I've gotten so far but with some issues - even after following this tutorial - Visual Guide to RelativeLayout
<?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:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:context=".LoginActivity">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="#drawable/backgroundhomescreen"
android:scaleType="fitXY" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText
android:id="#+id/login_txt_Username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#layout/textboxlogin"
android:hint="Username"
android:layout_centerHorizontal="true"
android:inputType="textEmailAddress"
android:maxLines="1"
android:scrollbars="none"
android:textColor="#fff"
android:textColorHint="#ddd" />
<EditText
android:id="#+id/login_txt_Password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#layout/textboxlogin"
android:hint="Password"
android:layout_centerHorizontal="true"
android:inputType="textPassword"
android:maxLines="1"
android:scrollbars="none"
android:textColor="#fff"
android:textColorHint="#ddd"
android:layout_below="#id/login_txt_Username"
/>
<Button
android:id="#+id/login_btn_submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="SIGN IN"
android:layout_centerHorizontal="true"
android:textColor="#fff"
android:textSize="25dp"
android:textStyle="bold"
android:typeface="normal"
android:background="#layout/buttonsigninbackground" />
<TextView
android:id="#+id/login_txt_or"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="- or -"
android:layout_centerHorizontal="true"
android:layout_above="#+id/login_btn_navCreateAccount"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="25dp"
android:textStyle="bold" />
<Button
android:id="#id/login_btn_navCreateAccount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#layout/buttoncreateaccountbackground"
android:text="CREATE AN ACCOUNT"
android:textColor="#fff"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="25dp"
android:textSize="25dp"
android:textStyle="bold"
android:typeface="normal" />
</RelativeLayout>
</RelativeLayout>
Ultimately I need a relative layout that's bottom aligned so I can place other views just above the previous. In my second code sample above, textview 'login_txt_or' that references login_btn_navCreateAccount seems to be ignored.
Any clue to why this is? If it's of any use, I'm using Xamarin.Android 4.10.1 in Xamarin Studio.
This is what I ended up with
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/activity_login_relativeLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/backgroundgameplaying"
android:scaleType="fitXY" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom"
android:layout_marginBottom="45dp">
<TextView
android:id="#+id/login_tv_error"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="15dp"
android:textColor="#f00" />
<EditText
android:id="#+id/login_txt_Username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="25dp"
android:background="#layout/textboxlogin"
android:hint="Username"
android:layout_centerHorizontal="true"
android:inputType="textEmailAddress"
android:maxLines="1"
android:scrollbars="none"
android:textColor="#fff"
android:textColorHint="#ddd"
android:layout_below="#id/login_tv_error" />
<EditText
android:id="#+id/login_txt_Password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="25dp"
android:background="#layout/textboxlogin"
android:hint="Password"
android:layout_centerHorizontal="true"
android:inputType="textPassword"
android:maxLines="1"
android:scrollbars="none"
android:textColor="#fff"
android:textColorHint="#ddd"
android:layout_below="#id/login_txt_Username" />
<Button
android:id="#+id/login_btn_submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/login_txt_Password"
android:layout_centerHorizontal="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="25dp"
android:textColor="#fff"
android:textSize="25dp"
android:textStyle="bold"
android:typeface="normal"
android:background="#layout/buttonsigninbackground"
android:text="SIGN IN" />
<TextView
android:id="#+id/loginTxtOr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/login_btn_submit"
android:layout_centerHorizontal="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_marginBottom="25dp"
android:textSize="25dp"
android:textStyle="bold|italic"
android:text="- or -" />
<Button
android:id="#+id/login_btn_navCreateAccount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="25dp"
android:layout_below="#id/loginTxtOr"
android:background="#layout/buttoncreateaccountbackground"
android:textColor="#fff"
android:textSize="25dp"
android:textStyle="bold"
android:typeface="normal"
android:text="CREATE AN ACCOUNT" />
</RelativeLayout>
</RelativeLayout>
i wan tto create sccreen like this image http://imgur.com/UVKCZdu my screen url is looklike this http://imgur.com/gLQw4iV
my screen not adjust facebook twitter iccon also show space on bottom below 3 buttons how do i fixed them? help me below is my xml code
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#C0C0C0" >
<ImageView
android:id="#+id/test_button_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:paddingTop="5dp"
android:src="#drawable/icon" >
</ImageView>
<TextView
android:id="#+id/test_button_text2"
android:layout_width="wrap_content"
android:paddingTop="10dp"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/test_button_image"
android:paddingLeft="10dp"
android:layout_toRightOf="#+id/test_button_image"
android:text="San Diego Unified"
android:textColor="#000000"
android:textSize="20sp" >
</TextView>
<TextView
android:id="#+id/test_button_text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:layout_alignLeft="#+id/test_button_text2"
android:layout_below="#+id/test_button_text2"
android:paddingBottom="10dp"
android:text="SCHOOL DISTRICT"
android:textColor="#000000" >
</TextView>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="40dp"
a
android:orientation="horizontal" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="left|center_vertical"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="left|center_vertical"
android:singleLine="true"
android:text="HEALTHY BODIES HEALTHY MINDS "
android:textColor="#000000"
android:textSize="12sp" />
<ImageButton
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:src="#drawable/facebook" />
<ImageButton
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:src="#drawable/twitter"
android:text="Button Text" />
</LinearLayout>
<RelativeLayout
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<EditText
android:id="#+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Search School By Name"
android:layout_centerVertical="true" >
</EditText>
<ImageView
android:id="#+id/imageView1"
android:padding="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/editText1"
android:layout_alignBottom="#+id/editText1"
android:layout_alignRight="#+id/editText1"
android:src="#drawable/title_search" />
</RelativeLayout>
<TextView
android:id="#+id/txtCaption"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:paddingBottom="3dp"
android:paddingLeft="10dp"
android:paddingTop="3dp"
android:text="SELECT A SCHOOL TO VIEW LUNCH OR BREAKFAST MENUS"
android:textColor="#000000"
android:textSize="10sp"
android:textStyle="bold" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#000000" />
<LinearLayout
android:id="#+id/lytContent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/txtCopyright"
android:background="#ffffff"
android:layout_below="#+id/lytTitlebar"
android:orientation="vertical" >
<ListView
android:id="#+id/listMainMenu"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#color/background"
android:dividerHeight="1dip"
android:fadeScrollbars="true" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#a8a8a8"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#a8a8a8"
android:orientation="horizontal" >
<Button
android:id="#+id/button1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.333"
android:background="#drawable/button_style"
android:text="FARM TO SCHOOL"
android:textColor="#color/text"
android:textSize="8sp"
android:textStyle="bold" />
<Button
android:id="#+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.333"
android:background="#drawable/button_style"
android:text="TAKE A SURVEY"
android:textColor="#color/text"
android:textSize="8sp"
android:textStyle="bold" />
<Button
android:id="#+id/button3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.333"
android:background="#drawable/button_style"
android:text="SHARE THIS APP"
android:textColor="#color/text"
android:textSize="8sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
You can't setText in an ImageView.. that's just for TextViews
What you can do instead is wrap an ImageView and a TextView inside a FrameLayout, then do your setText on the TextView. Make sure you define the ImageView first, so it's below the TextView's z-order.
Add image to text view like this:
<TextView
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:drawableRight="#drawable/protection_unprotected"
android:gravity="center_vertical"
android:paddingRight="5dp"
android:text="#string/protection_unprotected"
android:textSize="18sp"
android:textStyle="bold" />
android:drawableRight="#drawable/protection_unprotected"
For your Facebook and Twitter buttons you can add
android:background = "#null"
inside ImageButton tags for the unwanted background in buttons.
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#a8a8a8"
android:orientation="horizontal" >
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="#+id/headerLinearLay"
android:orientation="horizontal">
<ImageView
android:id="#+id/avatarImageView"
android:src="#drawable/icon"
android:layout_height="wrap_content"
android:layout_width="wrap_content"></ImageView>
<TextView
android:id="#+id/usernameTextView"
android:text="TextView"
android:paddingLeft="4dp"
android:layout_toRightOf="#id/avatarImageView"
android:layout_centerVertical="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content"></TextView>
</RelativeLayout>
</LinearLayout>