EditText doesn't show up - android

I have layout for my activity and it shows up everything besides two edittexts, here it is.
<?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="wrap_content"
android:fillViewport="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.hrle.androidapp.activity.ReadPostActivity"
android:id="#+id/arp">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_rp"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/colorAccent"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
/>
<ImageView
android:id="#+id/slika"
android:layout_width="220dp"
android:layout_height="141dp"
android:layout_below="#+id/naslov"
android:layout_marginEnd="5dp"
android:layout_toStartOf="#id/autor"
app:srcCompat="#mipmap/ic_launcher" />
<TextView
android:id="#+id/naslov"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:textAlignment="center"
android:textSize="40dp" />
<TextView
android:id="#+id/autor"
android:layout_width="190dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_below="#+id/naslov"
android:text="Autor: "
android:textSize="12sp" />
<TextView
android:id="#+id/datum"
android:layout_width="190dp"
android:layout_height="42dp"
android:layout_alignParentEnd="true"
android:layout_below="#+id/autor"
android:text="Datum: "
android:textSize="12sp" />
<TextView
android:id="#+id/lokacija"
android:layout_width="190dp"
android:layout_height="42dp"
android:layout_below="#+id/datum"
android:layout_alignParentEnd="true"
android:text="Lokacija: "
android:textSize="12sp" />
<TextView
android:id="#+id/likes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="100dp"
android:layout_below="#+id/opis"
android:drawableLeft="#drawable/ic_like"
/>
<TextView
android:id="#+id/dislikes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="#id/likes"
android:layout_marginStart="30dp"
android:layout_below="#id/opis"
android:drawableStart="#drawable/ic_dislike" />
<TextView
android:id="#+id/opis"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentStart="true"
android:layout_below="#+id/slika"
android:background="#drawable/border"
/>
<EditText
android:id="#+id/naslov_za_unos"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_above="#id/lv_comments"
android:layout_below="#id/likes"
android:hint="Unesite naslov"
android:inputType="text"/>
<EditText
android:id="#+id/opis_za_unos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#id/lv_comments"
android:layout_below="#id/naslov_za_unos"
android:hint="Unesite opis"
android:inputType="text"
/>
<Button
android:id="#+id/dugme_potvrde_kom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/dislikes"
android:layout_alignParentEnd="true"
android:layout_marginTop="30dp"
android:layout_marginEnd="100dp"
android:text="Objavi"
/>
<android.support.v7.widget.RecyclerView
android:id="#+id/lv_comments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/likes"
android:layout_marginTop="100dp"
/>
</RelativeLayout>
</ScrollView>
Here is the picture of design, edittexts should show up on position which I marked on picture. Can anyone figure out what makes it not show? And yes, I did everything in activity(findViewById etc.)
https://imgur.com/EltSZbi

Replace your code with these lines of code, I have used the LinearLayout for your view alignment, have a look in below solution
<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/arp"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.hrle.androidapp.activity.ReadPostActivity">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_rp"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/colorAccent"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
/>
<ImageView
android:id="#+id/slika"
android:layout_width="220dp"
android:layout_height="141dp"
android:layout_below="#+id/naslov"
android:layout_marginEnd="5dp"
android:layout_toStartOf="#id/autor"
app:srcCompat="#mipmap/ic_launcher" />
<TextView
android:id="#+id/naslov"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:textAlignment="center"
android:textSize="40dp" />
<TextView
android:id="#+id/autor"
android:layout_width="190dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_below="#+id/naslov"
android:text="Autor: "
android:textSize="12sp" />
<TextView
android:id="#+id/datum"
android:layout_width="190dp"
android:layout_height="42dp"
android:layout_alignParentEnd="true"
android:layout_below="#+id/autor"
android:text="Datum: "
android:textSize="12sp" />
<TextView
android:id="#+id/lokacija"
android:layout_width="190dp"
android:layout_height="42dp"
android:layout_alignParentEnd="true"
android:layout_below="#+id/datum"
android:text="Lokacija: "
android:textSize="12sp" />
<TextView
android:id="#+id/likes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/opis"
android:layout_marginStart="100dp"
android:drawableLeft="#drawable/ic_like"
/>
<TextView
android:id="#+id/dislikes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/opis"
android:layout_marginStart="30dp"
android:layout_toEndOf="#id/likes"
android:drawableStart="#drawable/ic_dislike"
/>
<TextView
android:id="#+id/opis"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentStart="true"
android:layout_below="#+id/slika"
android:background="#mipmap/ic_launcher" />
<LinearLayout
android:id="#+id/ll_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/dislikes"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<EditText
android:id="#+id/naslov_za_unos"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_above="#id/lv_comments"
android:layout_below="#id/likes"
android:hint="Unesite naslov"
android:inputType="text" />
<EditText
android:id="#+id/opis_za_unos"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#id/lv_comments"
android:layout_below="#id/naslov_za_unos"
android:hint="Unesite opis"
android:inputType="text" />
</LinearLayout>
<Button
android:id="#+id/dugme_potvrde_kom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/dislikes"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_weight="1"
android:gravity="center"
android:text="Objavi"
/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/lv_comments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/ll_input"
android:layout_marginTop="10dp" />
</RelativeLayout>

Try this:
<EditText
android:id="#+id/naslov_za_unos"
android:layout_width="200dp"
android:layout_height="50dp"
android:layout_above="#id/opis_za_unos"
android:layout_below="#id/likes"
android:layout_alignParentStart = true
android:hint="Unesite naslov"
android:inputType="text"
/>
<EditText
android:id="#+id/opis_za_unos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#id/lv_comments"
android:layout_below="#id/naslov_za_unos"
android:layout_alignParentStart = true
android:hint="Unesite opis"
android:inputType="text"
/>

Related

Setting a Button height to wrap_content not doing what is expected

I'm trying to position a couple of buttons at the bottom of the page and have set their height to wrap_content, like so:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/fragment_container"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/colorAccent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<TextView
android:id="#+id/words_prompt"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_below="#+id/appbar"
android:layout_margin="10dp"
android:text="#string/words_prompt" />
<EditText
android:id="#+id/word_list"
android:singleLine="false"
android:enabled="false"
android:lines="10"
android:textStyle="bold"
android:textColor="#color/colorPrimaryDark"
android:background="#ffffff"
android:inputType="textMultiLine"
android:layout_below="#+id/words_prompt"
android:layout_margin="10dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:gravity="top"
android:layout_width="180sp"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/time_left_prompt"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/word_list"
android:layout_toEndOf="#+id/word_list"
android:layout_below="#+id/words_prompt"
android:layout_margin="10dp"
android:text="#string/time_left_prompt" />
<TextView
android:id="#+id/time_left"
android:textStyle="bold"
android:layout_below="#+id/words_prompt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/time_left_prompt"
android:layout_toEndOf="#+id/time_left_prompt"
android:layout_margin="10dp" />
<EditText
android:id="#+id/typed_word"
android:focusable="false"
android:maxLength="10"
android:inputType="text"
android:textCursorDrawable="#drawable/custom_cursor"
android:enabled="false"
android:layout_below="#+id/word_list"
android:digits="abcdefghijklmnopqrstuvwxyz"
android:textColor="#color/colorPrimaryDark"
android:layout_margin="10dp"
android:hint="#string/type_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:id="#+id/done_button"
android:enabled="false"
android:text="#string/done_prompt"
android:layout_toRightOf="#+id/typed_word"
android:layout_toEndOf="#+id/typed_word"
android:layout_alignBaseline="#+id/typed_word"
android:layout_below="#+id/word_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<include
layout="#layout/keyboardlayout_en"
android:id="#+id/keyboard_layout"
android:visibility="invisible"
android:layout_centerInParent="true"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/done_button"/>
<Button
android:id="#+id/start_timer_button"
android:text="#string/start_timer_prompt"
android:layout_margin="10dp"
android:layout_below="#+id/done_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="#+id/best_score_prompt"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/start_timer_button"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:text="#string/best_score_prompt" />
<TextView
android:id="#+id/best_score"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/start_timer_button"
android:layout_toRightOf="#+id/best_score_prompt"
android:layout_toEndOf="#+id/best_score_prompt"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp" />
<TextView
android:id="#+id/elapsed_time_prompt"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_below="#+id/best_score_prompt"
android:layout_margin="10dp"
android:text="#string/elapsed_time_prompt" />
<TextView
android:id="#+id/elapsed_time"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_below="#+id/best_score_prompt"
android:layout_toRightOf="#+id/elapsed_time_prompt"
android:layout_toEndOf="#+id/elapsed_time_prompt"
android:layout_margin="10dp" />
<Button
android:id="#+id/reset_button"
android:text="#string/reset_prompt"
android:enabled="false"
android:layout_alignParentBottom="true"
android:layout_below="#+id/best_score_prompt"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="#+id/quit_button"
android:text="#string/quit_prompt"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_below="#+id/best_score_prompt"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
But the layout renders as this:
Why are the heights so off and what do I need to do to fix this (without hard-coding the button height with numbers or adding top margins)?
Remove in both buttons:
android:layout_below="#+id/best_score_prompt"
With:
Without:

My progress bar hiding behind other layouts

I have included a progress bar in my relative layout, but it is running behind the layout. Is there any way I can bring it in front show that it show when the page is loading.
[Sorry, I'm pasting whole XML file, cause I don't know where to put progress bar! as I'm newbie, I want you to help me. Sorry again!]
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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundcolor"
tools:context="com.tekitsolutions.remindme.Activity.AddReminderActivity">
<!--TODO:-> Toolbar Layout-->
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/toolbarcolor"
android:minHeight="?attr/actionBarSize"
app:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:title="#string/title_add_reminder" />
<ScrollView
android:id="#+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_below="#id/toolbar">
<RelativeLayout
android:id="#+id/layout_relative"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="#layout/row_progress_bar" />
<!--TODO:-> Parent Layout-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="vertical"
android:paddingLeft="#dimen/activity_vertical_padding"
android:paddingRight="#dimen/activity_vertical_margin">
<!--TODO:-> Title & Category Layout-->
<RelativeLayout
android:id="#+id/layout_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="#dimen/view_margin_top">
<LinearLayout
style="#style/dialog_main_linear_layout_style"
android:padding="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/title"
style="#style/heading_textview_style1"
android:text="#string/heading_title"
android:textSize="#dimen/heading_text_size" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" *"
android:textColor="#color/colorRed"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/title_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
style="#style/vector_image_style"
android:tint="?attr/iconcolor"
app:srcCompat="#drawable/ic_view_heading" />
<EditText
android:id="#+id/et_title"
style="#style/text_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginEnd="100dp"
android:backgroundTint="#color/colorIconLightGray"
android:digits="0123456789 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ अआइईउऊऋएऐओऔकखगघङचछजझञाटठडढणतथदधनपफबभमयरलवशषसहक्षत्रज्ञ ा ि ी ु ू ृ े ै ो ौ ं ः "
android:imeOptions="actionNext"
android:singleLine="true"
android:maxLength="25"
android:maxLines="1"
android:textSize="17sp" />
</LinearLayout>
<!--TODO:-> Title error-->
<include
android:id="#+id/tv_title_error"
layout="#layout/row_error_textview" />
<RelativeLayout
android:id="#+id/layout_category"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Spinner
android:id="#+id/spin_list"
style="#style/Widget.AppCompat.Spinner.Underlined"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginEnd="8dp"
android:backgroundTint="?attr/iconcolor"
android:dropDownVerticalOffset="17dp"
android:spinnerMode="dropdown"
android:textSize="#dimen/input_text_size" />
<TextView
android:id="#+id/tv_selected_category"
style="#style/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_centerHorizontal="true"
android:layout_toLeftOf="#+id/circle_card1"
android:text="#string/hint_select_category"
android:textSize="#dimen/input_text_size" />
<androidx.cardview.widget.CardView
android:id="#+id/circle_card1"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:elevation="12dp"
android:innerRadius="0dp"
android:shape="ring"
android:thicknessRatio="0"
app:cardCornerRadius="13dp">
<ImageView
android:id="#+id/category_image"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:visibility="visible"
app:srcCompat="#drawable/ic_keyboard_arrow_down_black_24dp" />
<Button
android:id="#+id/custom_category_image"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#drawable/bg_circle_btn"
android:text="A"
android:textColor="#color/colorWhite"
android:textSize="12dp"
android:visibility="gone"
app:srcCompat="#drawable/ic_navigate_next_black_24dp" />
</androidx.cardview.widget.CardView>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/colorDarkerGray" />
<!--TODO:-> Amount Layout-->
<RelativeLayout
android:id="#+id/layout_amount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/view_margin_top">
<LinearLayout
style="#style/dialog_main_linear_layout_style"
android:padding="8dp">
<TextView
style="#style/heading_textview_style"
android:text="#string/heading_amount"
android:textSize="#dimen/heading_text_size" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/iv_amount"
style="#style/vector_image_style"
android:tint="?attr/iconcolor"
app:srcCompat="#drawable/currency_inr" />
<EditText
android:id="#+id/et_amount"
style="#style/text_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:backgroundTint="#color/colorIconLightGray"
android:hint="0.00"
android:inputType="numberDecimal"
android:maxLength="7"
android:textSize="17sp" />
</LinearLayout>
<RelativeLayout
android:id="#+id/layout_payment_option"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible">
<TextView
android:id="#+id/tv_selected_payment_mode"
style="#style/text_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_toLeftOf="#+id/circle_card2"
android:gravity="end"
android:text="#string/select_payment"
android:textSize="#dimen/input_text_size" />
<androidx.cardview.widget.CardView
android:id="#+id/circle_card2"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentRight="true"
android:elevation="12dp"
android:innerRadius="0dp"
android:shape="ring"
android:thicknessRatio="0"
app:cardCornerRadius="13dp">
<ImageView
android:id="#+id/payment_image"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
app:srcCompat="#drawable/ic_keyboard_arrow_down_black_24dp"></ImageView>
</androidx.cardview.widget.CardView>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/colorDarkerGray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:padding="8dp"
android:text="Select Date and Time"
style="#style/text_color"
android:textSize="16sp"
/>
<!--TODO:-> Due date Layout-->
<RelativeLayout
android:id="#+id/layout_due_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/view_margin_top">
<ImageView
android:id="#+id/iv_due_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="?attr/iconcolor"
app:srcCompat="#drawable/ic_icon_date" />
<RelativeLayout
android:id="#+id/date_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginBottom="8dp"
android:layout_toRightOf="#id/iv_due_date">
<TextView
style="#style/text_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/heading_due_date"
android:textSize="#dimen/heading_text_size" />
<TextView
android:id="#+id/tv_due_date"
style="#style/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="end"
android:layout_marginRight="12dp"
android:hint="YYYY-MM-DD"
android:textAlignment="textEnd"
android:textSize="#dimen/input_text_size" />
</RelativeLayout>
</RelativeLayout>
<!--TODO:-> Due date error-->
<include
android:id="#+id/tv_due_date_error"
layout="#layout/row_error_textview" />
<!--TODO:-> Alarm Layout-->
<RelativeLayout
android:id="#+id/layout_alarm_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/layout_due_date"
android:layout_marginTop="#dimen/view_margin_top"
android:layout_marginBottom="8dp">
<ImageView
android:id="#+id/iv_alarm_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="?attr/iconcolor"
app:srcCompat="#drawable/ic_icon_alarm" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_toRightOf="#id/iv_alarm_time"
android:orientation="vertical">
<TextView
style="#style/text_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/heading_alarm_time"
android:textSize="#dimen/heading_text_size" />
<TextView
android:id="#+id/tv_alarm_time"
style="#style/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="end"
android:layout_marginRight="12dp"
android:hint="HH:MM"
android:textAlignment="textEnd"
android:textSize="#dimen/input_text_size" />
<TextView
android:id="#+id/tv_error_alarm_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Please select Alarm Time"
android:textColor="#color/colorRed"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>
<!--TODO:-> Alarm error-->
<include
android:id="#+id/tv_time_error"
layout="#layout/row_error_textview" />
<RelativeLayout
android:id="#+id/frequency_layout"
style="#style/sub_relative_layout_style">
<TextView
style="#style/sub_text_view_style"
android:text="Alarm Frequency" />
<ImageView
android:id="#+id/collapse"
style="#style/visibilities_image_style"
android:layout_centerVertical="true"
android:visibility="visible"
app:srcCompat="#drawable/ic_keyboard_arrow_down_black_24dp" />
<ImageView
android:id="#+id/expand"
style="#style/visibilities_image_style"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:visibility="gone"
app:srcCompat="#drawable/ic_keyboard_arrow_up_black_24dp" />
</RelativeLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/colorDarkerGray" />
<!--TODO:-> Note Layout-->
<RelativeLayout
android:id="#+id/layout_notes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/layout_repeat"
android:layout_marginTop="#dimen/view_margin_top">
<ImageView
android:id="#+id/iv_note"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginLeft="8dp"
android:layout_marginRight="12dp"
android:tint="?attr/iconcolor"
app:srcCompat="#drawable/ic_keyboard_arrow_down_black_24dp" />
<LinearLayout
android:id="#+id/note_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_toLeftOf="#+id/iv_note"
android:orientation="horizontal">
<TextView
style="#style/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/heading_note"
android:textSize="#dimen/heading_text_size" />
<TextView
android:id="#+id/note_desc"
android:textColor="?attr/textcolor"
android:textSize="16sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:maxLines="4" />
</LinearLayout>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="8dp"
android:background="#color/colorDarkerGray" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
row_progress_bar:
<?xml version="1.0" encoding="utf-8"?>
<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/progress_bar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:theme="#style/AppTheme.WhiteAccent"
android:visibility="gone" />

How to put this imageView in this place? - Android

I've got a problem with adding logo to my app.
Now it's like:
HERE IS A LOGO - CLICK (haven't got 10 reputation)
I want to have a imageview with logo (id: logo) above the box with login.
How to make it?
Layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:facebook="http://schemas.android.com/tools"
xmlns:fb="http://schemas.android.com/tools"
android:id="#+id/mainView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#drawable/log"
android:gravity="center"
android:orientation="vertical">
<ScrollView
android:background="#drawable/log"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true">
<RelativeLayout
android:background="#drawable/login"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_width="350dp"
android:layout_marginLeft="17dp"
android:layout_height="300dp"
android:layout_marginTop="120dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
app:srcCompat="#drawable/napis"
android:id="#+id/logosek" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="#+id/social_signin_layout"
android:layout_marginTop="10dp"
android:background="#color/md_white_1000"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="#+id/tv_or"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginTop="4dp"
android:text="#string/screen_login_or_label"
android:textColor="#color/md_black_1000"
android:textSize="24sp" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:textColorHint="#color/material_color_primary"
app:hintAnimationEnabled="true"
app:hintTextAppearance="#style/TextAppearance.AppCompat.Small">
<EditText
android:id="#+id/et_usernamelogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/screen_register_hint_email"
android:inputType="text"
android:singleLine="true"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
<!--<EditText-->
<!--android:id="#+id/"-->
<!--style="#style/edittextstyle"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="#dimen/editlayimg_edittextheight"-->
<!--android:layout_marginTop="#dimen/five"-->
<!--android:gravity="bottom"-->
<!--android:hint="#string/login_storeid"-->
<!--android:singleLine="true"-->
<!--android:textColorHint="#color/fontcolorlight"-->
<!--android:textSize="18sp" />-->
<!--<View-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="#dimen/one"-->
<!--android:layout_marginLeft="#dimen/five"-->
<!--android:layout_marginRight="#dimen/five"-->
<!--android:background="#color/fontcolorlight" />-->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:textColorHint="#color/material_color_primary"
app:hintAnimationEnabled="true"
app:hintTextAppearance="#style/TextAppearance.AppCompat.Small">
<EditText
android:id="#+id/et_passwordlogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="text"
android:singleLine="true"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/btn_login"
style="#style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="match_parent"
android:layout_height="#dimen/btnheight"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="4dp"
android:background="#color/material_color_accent"
android:text="#string/screen_login_button_login"
android:textColor="#color/md_white_1000"
android:textSize="#dimen/btnlogin_textsize" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="4dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/txt_signup"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginRight="16dp"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:gravity="left"
android:paddingLeft="8dp"
android:text="#string/screen_login_button_sign_up"
android:textColor="#color/md_black_1000"
android:textSize="16sp"
android:layout_width="wrap_content" />
<TextView
android:id="#+id/tv_forgotpwd"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:gravity="right"
android:paddingRight="8dp"
android:text="Forgot Password?"
android:textColor="#color/md_black_1000"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/lay_above"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/md_brown_100"
android:orientation="vertical"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
</LinearLayout>
<LinearLayout
android:id="#+id/social_signin_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="100dp"
android:layout_below="#+id/lay_above"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="Choose account to login"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#color/md_yellow_50"
android:textAlignment="center"
android:textSize="17sp" />
<com.google.android.gms.common.SignInButton
android:id="#+id/btn_sign_in"
android:layout_width="300dp"
android:layout_marginBottom="0dp"
android:layout_marginLeft="16dp"
android:layout_gravity="center_vertical|center_horizontal"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginRight="16dp"
android:padding="0dp"
android:theme="#style/Widget.AppCompat.Button"
app:theme="#style/Widget.AppCompat.Button"
android:layout_height="35dp"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_marginTop="5dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="or"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#color/AntiqueWhite"
android:textAlignment="center"
android:textSize="18sp"
android:id="#+id/textView10" />
<com.facebook.login.widget.LoginButton
android:id="#+id/authButton"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="10dp"
android:textSize="18sp"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_width="300dp"
android:layout_height="50dp" />
<TextView
android:layout_width="match_parent"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="#string/please_login_in"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#color/md_yellow_50"
android:textAlignment="center"
android:textSize="15sp"
android:id="#+id/textView12" />
</LinearLayout>
<TextView
android:text="Welcome, Saiyan!"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:id="#+id/textView14"
android:textSize="36sp"
android:layout_below="#+id/lay_above"
android:layout_centerHorizontal="true"
android:textColor="#color/Yellow" />
</RelativeLayout>
</ScrollView>
</LinearLayout>
just put the imageview before the relative layout
instead of:
<RelativeLayout
android:background="#drawable/login"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_width="350dp"
android:layout_marginLeft="17dp"
android:layout_height="300dp"
android:layout_marginTop="120dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
app:srcCompat="#drawable/napis"
android:id="#+id/logosek" />
do:
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
app:srcCompat="#drawable/napis"
android:id="#+id/logosek" />
<RelativeLayout
android:background="#drawable/login"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_width="350dp"
android:layout_marginLeft="17dp"
android:layout_height="300dp"
android:layout_marginTop="120dp">
this will put imageview in the scrollview and below it the rest of the relativelayout , all because of the linearlayout orientation which directed vertical , so every child will come below the former.
EDIT :
you also need to put the scrollview first and then put the linearlayout , this should be it :
<?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:facebook="http://schemas.android.com/tools"
xmlns:fb="http://schemas.android.com/tools"
android:background="#drawable/log"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true">
<LinearLayout
android:id="#+id/mainView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#drawable/log"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
app:srcCompat="#drawable/napis"
android:id="#+id/logosek" />
<RelativeLayout
android:background="#drawable/login"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_width="350dp"
android:layout_marginLeft="17dp"
android:layout_height="300dp"
android:layout_marginTop="120dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="#+id/social_signin_layout"
android:layout_marginTop="10dp"
android:background="#color/md_white_1000"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="#+id/tv_or"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginTop="4dp"
android:text="#string/screen_login_or_label"
android:textColor="#color/md_black_1000"
android:textSize="24sp" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:textColorHint="#color/material_color_primary"
app:hintAnimationEnabled="true"
app:hintTextAppearance="#style/TextAppearance.AppCompat.Small">
<EditText
android:id="#+id/et_usernamelogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/screen_register_hint_email"
android:inputType="text"
android:singleLine="true"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
<!--<EditText-->
<!--android:id="#+id/"-->
<!--style="#style/edittextstyle"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="#dimen/editlayimg_edittextheight"-->
<!--android:layout_marginTop="#dimen/five"-->
<!--android:gravity="bottom"-->
<!--android:hint="#string/login_storeid"-->
<!--android:singleLine="true"-->
<!--android:textColorHint="#color/fontcolorlight"-->
<!--android:textSize="18sp" />-->
<!--<View-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="#dimen/one"-->
<!--android:layout_marginLeft="#dimen/five"-->
<!--android:layout_marginRight="#dimen/five"-->
<!--android:background="#color/fontcolorlight" />-->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:textColorHint="#color/material_color_primary"
app:hintAnimationEnabled="true"
app:hintTextAppearance="#style/TextAppearance.AppCompat.Small">
<EditText
android:id="#+id/et_passwordlogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="text"
android:singleLine="true"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/btn_login"
style="#style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="match_parent"
android:layout_height="#dimen/btnheight"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="4dp"
android:background="#color/material_color_accent"
android:text="#string/screen_login_button_login"
android:textColor="#color/md_white_1000"
android:textSize="#dimen/btnlogin_textsize" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="4dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/txt_signup"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginRight="16dp"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:gravity="left"
android:paddingLeft="8dp"
android:text="#string/screen_login_button_sign_up"
android:textColor="#color/md_black_1000"
android:textSize="16sp"
android:layout_width="wrap_content" />
<TextView
android:id="#+id/tv_forgotpwd"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:gravity="right"
android:paddingRight="8dp"
android:text="Forgot Password?"
android:textColor="#color/md_black_1000"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/lay_above"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/md_brown_100"
android:orientation="vertical"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
</LinearLayout>
<LinearLayout
android:id="#+id/social_signin_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="100dp"
android:layout_below="#+id/lay_above"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="Choose account to login"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#color/md_yellow_50"
android:textAlignment="center"
android:textSize="17sp" />
<com.google.android.gms.common.SignInButton
android:id="#+id/btn_sign_in"
android:layout_width="300dp"
android:layout_marginBottom="0dp"
android:layout_marginLeft="16dp"
android:layout_gravity="center_vertical|center_horizontal"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginRight="16dp"
android:padding="0dp"
android:theme="#style/Widget.AppCompat.Button"
app:theme="#style/Widget.AppCompat.Button"
android:layout_height="35dp"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_marginTop="5dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="or"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#color/AntiqueWhite"
android:textAlignment="center"
android:textSize="18sp"
android:id="#+id/textView10" />
<com.facebook.login.widget.LoginButton
android:id="#+id/authButton"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="10dp"
android:textSize="18sp"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_width="300dp"
android:layout_height="50dp" />
<TextView
android:layout_width="match_parent"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="#string/please_login_in"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#color/md_yellow_50"
android:textAlignment="center"
android:textSize="15sp"
android:id="#+id/textView12" />
</LinearLayout>
<TextView
android:text="Welcome, Saiyan!"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:id="#+id/textView14"
android:textSize="36sp"
android:layout_below="#+id/lay_above"
android:layout_centerHorizontal="true"
android:textColor="#color/Yellow" />
</RelativeLayout>
</LinearLayout>
</ScrollView>

Can't get to the bottom of the content with my scrollview

I have my xml file. It is a RelativeLayout with a ScrollView and inside the ScrollView I have LinearLayout and many more. The problem is that I can't reach the end of the view, as you can see it end with a "Sign Up" button... But my view is cut by the scroll and I can just see the middle of the button, the other middle is off screen.
So, any suggestions for how can I fix this? How can I work with the ScrollView so it wraps all of my content...
Check it:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/bg_signup"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".SignUp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:background="#xml/signup_round">
<LinearLayout
android:layout_width="260dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/new_signup" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="#string/signup"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
</LinearLayout>
<EditText
android:id="#+id/first_name_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="-25dp"
android:hint="#string/first_name"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/last_name_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/last_name"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/email_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/email_confirmation_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/email_confirmation"
android:inputType="textEmailAddress"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/password_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/password"
android:inputType="textPassword"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/password_confirmation_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/password_confirmation"
android:inputType="textPassword"
android:textColor="#color/colorRB" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:text="#string/sex"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
<Spinner
android:id="#+id/sex_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-25dp"
android:entries="#array/sex_array" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:text="#string/brithday"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-35dp"
android:orientation="horizontal">
<Button
android:id="#+id/birthdayBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="#color/fbutton_color_transparent"
android:onClick="showDatePickerDialog"
android:text="#string/birthdayBtn"
android:textAllCaps="false"
android:textColor="#color/colorRB" />
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="#+id/dateSelectedTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="--/--/--"
android:textColor="#color/colorRB"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingBottom="5dp"
android:text="#string/terms_conditions"
android:textColor="#color/colorRB"
android:textStyle="bold" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0" />
</LinearLayout>
<Button
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:background="#xml/button_round"
android:onClick=""
android:text="#string/signup"
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick=""
android:src="#drawable/close_signup" />
</RelativeLayout>

Layout alignment Query {Center Horizontal + Center Vertical}

Must be very simple to solve but I'm not able to solve this.
I want to align the "top image and log_in_box", so the whole thing appear in exact center (Horizontal+Vertical center) of the screen.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent" android:orientation="vertical">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"
android:layout_gravity="center_vertical|center_horizontal">
<ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="#drawable/ic_launcher"
android:contentDescription="" />
<LinearLayout android:id="#+id/log_in_box" android:layout_width="match_parent" android:layout_height="wrap_content"
android:orientation="vertical">
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="User ID"
android:inputType="text" />
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp"
android:hint="Password" android:inputType="textPassword" />
<CheckBox android:layout_width="match_parent" android:layout_height="wrap_content" android:checked="true"
android:text="Remember Me" android:layout_marginTop="10dp" />
<Button android:id="#+id/log_in" android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:text="Log In" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Current Look
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerInParent="true" >
<ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="#drawable/ic_launcher"
android:contentDescription="" />
<LinearLayout android:id="#+id/log_in_box" android:layout_width="match_parent" android:layout_height="wrap_content"
android:orientation="vertical">
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="User ID"
android:inputType="text" />
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp"
android:hint="Password" android:inputType="textPassword" />
<CheckBox android:layout_width="match_parent" android:layout_height="wrap_content" android:checked="true"
android:text="Remember Me" android:layout_marginTop="10dp" />
<Button android:id="#+id/log_in" android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:text="Log In" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Try this.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent" android:orientation="vertical">
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_gravity="center_horizontal"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true">
<ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="#drawable/ic_launcher"
android:contentDescription="" />
<LinearLayout android:id="#+id/log_in_box" android:layout_width="match_parent" android:layout_height="wrap_content"
android:orientation="vertical">
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="User ID"
android:inputType="text" />
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp"
android:hint="Password" android:inputType="textPassword" />
<CheckBox android:layout_width="match_parent" android:layout_height="wrap_content" android:checked="true"
android:text="Remember Me" android:layout_marginTop="10dp" />
<Button android:id="#+id/log_in" android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:text="Log In" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:contentDescription=""
android:src="#drawable/ic_launcher" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="User ID"
android:inputType="text" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:hint="Password"
android:inputType="textPassword" />
<CheckBox
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:checked="true"
android:text="Remember Me" />
<Button
android:id="#+id/log_in"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Log In" />

Categories

Resources