Hide the background of parent layout - android

This is an alert dialog. I don't want to show the grey coloured portion (at top), which is background of the parent layout; instead that portion should be clear and the previous activity should be shown there as being shown outside the dialog. Also the border of the circular image view be tight with the image. How do I do that? Thanks in advance.
Mylayout.xml
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#727272">
<RelativeLayout
android:id="#+id/card_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="#+id/card_save"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:foreground="?android:attr/selectableItemBackground"
card_view:cardBackgroundColor="#ffffff"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="0dp"
card_view:cardUseCompatPadding="false">
<RelativeLayout
android:id="#+id/rl_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<android.support.design.widget.TextInputLayout
android:id="#+id/til_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="60dp">
<TextView
android:id="#+id/tv_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/textView_DoB"
android:paddingTop="10dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:hint="#string/dd_mm_yyyy"
android:textColor="#android:color/black"
android:textAlignment="viewStart"
android:textSize="25sp"
android:background="#drawable/border_date"/>
</android.support.design.widget.TextInputLayout>
<ImageButton
android:id="#+id/ib_DoB_in_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#id/til_date"
android:layout_marginTop="63dp"
android:layout_marginEnd="5dp"
android:background="#mipmap/calendar"
android:contentDescription="#string/calendar_image" />
<TextView
android:id="#+id/textView_DoB_weekday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#id/til_date"
android:layout_marginTop="20dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:textColor="#android:color/black"
android:textAlignment="viewStart"
android:textSize="20sp"
/>
<android.support.design.widget.TextInputLayout
android:id="#+id/til_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/til_date"
android:layout_marginTop="10dp">
<android.support.design.widget.TextInputEditText
android:id="#+id/et_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/name"
android:inputType="textCapWords" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/til_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/til_name"
android:layout_marginTop="10dp">
<Spinner
android:id="#+id/sp_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="#array/Category">
</Spinner>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/til_mobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/til_category"
android:layout_marginTop="10dp">
<android.support.design.widget.TextInputEditText
android:id="#+id/et_mobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:hint="#string/mobile_number_optional"
android:inputType="number"
android:maxLength="13"/>
</android.support.design.widget.TextInputLayout>
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/til_mobile"
android:layout_marginTop="10dp">
<TableRow>
<Button
android:id="#+id/btn_discard"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_weight="1"
android:text="#string/discard" />
<Button
android:id="#+id/btn_save_data"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_weight="1"
android:text="#string/save" />
</TableRow>
</TableLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/civ_profile_image"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:src="#mipmap/ic_person_image"
card_view:civ_border_width="2dp"
card_view:civ_border_color="#ffffff"/>
</RelativeLayout>

add this on your parent xml
android:background="#android:color/transparent"
and add this to your code so the whole alert dialog become transparent
alertDialog.getWindow().setDimAmount(0);

Related

Bottom Sheet Issue

This is what i want to build.
the circular portion will be outside of layout and the rest portion will be transparent as default action
Till now i have achieved.
the circular portion is getting out but the parent layout is not taking any transparency what i need. I have tried to give the transparent color but its not taking. what i need is the blue portion in the second image, i need it transparent just like when dialog appears. But it is taking the color from parent layout.
Any reference will be appreciated.TIA
Here is my layout xml :
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:id="#+id/bottom_layout"
android:background="#color/colorRed"
>enter code here
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/_25sdp"
android:background="#color/colorWhite"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_20sdp"
android:layout_marginRight="#dimen/_20sdp"
android:layout_marginTop="#dimen/_45sdp"
android:orientation="vertical">
<TextView
android:id="#+id/firstName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_7sdp"
android:backgroundTint="#color/colorLightGrayText"
android:gravity="center"
android:hint="#string/settings"
android:inputType="text"
android:singleLine="true"
android:textColor="#color/colorBlackText"
android:textColorHint="#color/colorBlackText"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="#dimen/_18sdp"
android:textStyle="bold"/>
<CustomTextView
android:id="#+id/lastName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_10sdp"
android:backgroundTint="#color/colorLightGrayText"
android:gravity="center"
android:hint="#string/login_to_access_settings"
android:inputType="text"
android:singleLine="true"
android:textColor="#color/colorGray"
android:textColorHint="#color/colorGray"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="#dimen/_15sdp" />
<android.support.design.widget.TextInputLayout
android:id="#+id/userName_Wrapper"
android:layout_width="match_parent"
android:layout_height="#dimen/_50sdp"
android:layout_marginTop="#dimen/_25sdp"
android:textColorHint="#color/colorLightGrayText"
android:theme="#style/TextLabelGray"
app:errorTextAppearance="#style/error_appearance_gray">
<CustomEditText
android:id="#+id/userName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/colorLightGrayText"
android:hint="Username"
android:inputType="text"
android:singleLine="true"
android:textColor="#color/colorGray"
android:textColorHint="#color/colorWhite"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="#dimen/_14sdp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/password_wrapper"
android:layout_width="match_parent"
android:layout_height="#dimen/_50sdp"
android:textColorHint="#color/colorLightGrayText"
android:theme="#style/TextLabelGray"
app:errorTextAppearance="#style/error_appearance_gray">
<CustomEditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#color/colorLightGrayText"
android:hint="#string/password"
android:inputType="textPassword"
android:singleLine="true"
android:textColor="#color/colorGray"
android:textColorHint="#color/colorWhite"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="#dimen/_14sdp" />
</android.support.design.widget.TextInputLayout>
<CustomTextView
android:id="#+id/logInSettingWrapper"
android:layout_width="match_parent"
android:layout_height="#dimen/_50sdp"
android:layout_marginBottom="#dimen/_20sdp"
android:layout_marginTop="#dimen/_10sdp"
android:background="#drawable/bg_gray_rounded_rect"
android:gravity="center"
android:padding="#dimen/_10sdp"
android:text="#string/login_to_settings"
android:textAllCaps="true"
android:textColor="#color/colorWhite"
android:textSize="#dimen/_16sdp"
android:textStyle="bold" />
<ImageView
android:id="#+id/btn_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="#dimen/_15sdp"
android:layout_marginBottom="#dimen/_15sdp"
android:src="#drawable/cross_pg_bottom_gray" />
</LinearLayout>
</LinearLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center_horizontal"
android:layout_marginBottom="-50dp"
android:background="#drawable/bg_bottom_sheet">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="#drawable/nav_settings" />
</FrameLayout>
</FrameLayout>
</LinearLayout>
you just need to make transparent your blue color layout .I hope it helps you unless you update your xml file.

Text typed not showing on Lollipop in Fragment layout

I have this layout of fragment:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="fragments.FrgLogin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="10dp">
<ImageView
android:id="#+id/logoFragmentLogin"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:layout_margin="20dp"
android:src="#drawable/logo_erp24h"
android:transitionName="logoTransition" />
<LinearLayout
android:id="#+id/loginLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/proxima_nova"
android:gravity="center"
android:text="#string/bemVindo"
android:textColor="#color/black"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/proxima_nova"
android:gravity="center"
android:text="#string/instrucaoLogin"
android:textColor="#color/gray"
android:textSize="15sp"
android:textStyle="bold" />
<LinearLayout
android:id="#+id/linearLayoutTwo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="20dp"
android:paddingLeft="50dp"
android:paddingRight="50dp"
android:paddingTop="20dp">
<EditText
android:id="#+id/usernameEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/proxima_nova"
android:hint="#string/usuario"
android:textIsSelectable="true"
android:textColor="#color/gray"
android:textColorHint="#color/light_gray"
android:theme="#style/loginFields" />
<android.support.design.widget.TextInputLayout
android:id="#+id/etPasswordLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hintEnabled="false"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/gray">
<android.support.design.widget.TextInputEditText
android:id="#+id/passwordEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/proxima_nova"
android:hint="#string/senha"
android:inputType="textPassword"
android:textColor="#color/gray"
android:textColorHint="#color/light_gray"
android:theme="#style/loginFields" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/loginEnterButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/blue_background"
android:clickable="true"
android:padding="6dp">
<ImageView
android:id="#+id/loginEnterImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#mipmap/ic_right_arrow" />
<ProgressBar
android:id="#+id/loginEnterProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateTint="#color/white"
android:visibility="invisible" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:fontFamily="#font/proxima_nova"
android:text="#string/entrar"
android:textColor="#color/primary"
android:textSize="20sp"
android:textStyle="bold|italic" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
When a digit a text in username and password fields, the cursor accompanies the text, but nothing appear. This fragment is load inside a Acitivty on a Frame Layout. This bug happens only on Android Lollipop device, on emulator and real smartphone;
I can select text and copy, cut, paste, but continues invisible
Please help me !!
Methods used on Fragment class with setVisibility not working

How to align Ui Components inside linear layout

Hi All could someone direct me on how i could align the Spinners and Edit text attached in the screen
Thank you for your help
XML file - below is the layout XML file for the UI screen
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context="eudhar.com.eudhar.transaction.MakeTransactionFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Make Transaction"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Small"
style="#style/Base.V7.Widget.AppCompat.EditText"/>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.toptoche.searchablespinnerlibrary.SearchableSpinner
android:id="#+id/selectCustomer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:hint="Select customer"
style="#style/Base.Widget.AppCompat.Spinner.Underlined"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Spinner
android:id="#+id/selectTransactionType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:hint="Select Transaction Type"
style="#style/Base.Widget.AppCompat.Spinner.Underlined"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_amount"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/editTextAmount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Amount in Rs."
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:inputType="number" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/editTextTransactionDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Transaction Date"
android:inputType="none"
/>
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/buttonAddTrasaction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Add Transaction" />
</LinearLayout>
Give margin to your Linear /Relative layout, else share your code, so I can easily give you the answer.
Is this okay?
Try this below code, i have given paddingLeft and paddingRight "5dp" to the parent layout itself. You may adjust as you need.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true"
android:paddingLeft="5dp"
android:paddingRight="5dp"
tools:context="eudhar.com.eudhar.transaction.MakeTransactionFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Make Transaction"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Small"
style="#style/Base.V7.Widget.AppCompat.EditText"/>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.toptoche.searchablespinnerlibrary.SearchableSpinner
android:id="#+id/selectCustomer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:hint="Select customer"
style="#style/Base.Widget.AppCompat.Spinner.Underlined"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Spinner
android:id="#+id/selectTransactionType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:hint="Select Transaction Type"
style="#style/Base.Widget.AppCompat.Spinner.Underlined"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_amount"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/editTextAmount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Amount in Rs."
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:inputType="number" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/editTextTransactionDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Transaction Date"
android:inputType="none"
/>
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/buttonAddTrasaction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Add Transaction" />
</LinearLayout>

Content layout xml double heigth size inside a NestedScrollView

I have a Coordinator layout in activity xml and an include layout that have a content layout xml. Like this:
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true"
android:id="#+id/main">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="#layout/content_sign_in" />
</android.support.v4.widget.NestedScrollView>
When i put my content layout inside a nestedscrollview my content layout double your heigth. Anyone can help me?
My Content layout xml:
<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/content_sign_in"
android:layout_width="match_parent"
android:background="#drawable/sign_up_bg"
android:layout_height="match_parent"
tools:showIn="#layout/activity_sign_in">
<ImageButton
android:id="#+id/arrow_back"
android:layout_marginTop="15dp"
android:layout_marginLeft="10dp"
android:scaleType="centerInside"
android:padding="5dp"
android:src="#drawable/ic_back_white"
android:background="#android:color/transparent"
android:layout_width="40dp"
android:layout_height="40dp" />
<ImageView
android:scaleType="centerInside"
android:layout_below="#+id/arrow_back"
android:id="#+id/logo"
android:layout_marginTop="6dp"
android:layout_centerHorizontal="true"
android:layout_width="78dp"
android:layout_height="45dp" />
<android.support.design.widget.TextInputLayout
android:textColorHint="#color/color_80ffffff"
android:id="#+id/input_layout_email"
android:layout_marginLeft="46dp"
android:hint=" "
android:layout_marginRight="46dp"
android:layout_marginTop="74dp"
android:layout_below="#+id/logo"
app:errorTextAppearance="#style/error_appearance"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.AppCompatEditText
android:id="#+id/work_email"
android:gravity="center"
android:theme="#style/EditTextLogin"
android:textColorHint="#color/color_80ffffff"
android:hint="#string/hint_work_email"
android:textColor="#android:color/white"
android:textSize="14sp"
android:inputType="textEmailAddress"
android:imeOptions="actionNext"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:textColorHint="#color/color_80ffffff"
android:id="#+id/input_layout_password"
android:layout_marginLeft="46dp"
android:hint=" "
android:theme="#style/EditTextLogin"
android:layout_marginRight="46dp"
android:layout_below="#+id/input_layout_email"
app:errorTextAppearance="#style/error_appearance"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.AppCompatEditText
android:id="#+id/password"
android:gravity="center"
android:textColorHint="#color/color_80ffffff"
android:hint="#string/hint_password"
android:textColor="#android:color/white"
android:textSize="14sp"
android:inputType="textPassword"
android:imeOptions="actionDone"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<Button
android:layout_below="#+id/input_layout_password"
android:id="#+id/btn_sign_in"
android:textColor="#android:color/white"
android:text="#string/btn_login"
android:layout_marginTop="26dp"
android:background="#color/colorAccent"
android:layout_marginRight="60dp"
android:layout_marginLeft="60dp"
android:layout_width="match_parent"
android:layout_height="40dp" />
<RelativeLayout
android:layout_marginTop="17dp"
android:layout_below="#+id/btn_sign_in"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/label_sign_up"
android:textSize="14sp"
android:text="#string/lbl_sign_up"
android:textColor="#color/color_80ffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_toRightOf="#+id/label_sign_up"
android:textStyle="bold"
android:layout_marginLeft="5dp"
android:id="#+id/btn_sign_up"
android:textSize="14sp"
android:text="#string/txt_sign_up"
android:textColor="#android:color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
<TextView
android:id="#+id/forgot_password"
android:textColor="#color/color_80ffffff"
android:textSize="14sp"
android:gravity="center"
android:text="#string/text_forgot_password"
android:layout_marginBottom="20dp"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RelativeLayout
android:visibility="gone"
android:id="#+id/layout_resend"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="86dp">
<ImageView
android:scaleType="fitXY"
android:src="#drawable/pink_bar"
android:layout_width="match_parent"
android:layout_height="86dp" />
<Button
android:id="#+id/btn_resend"
android:layout_marginRight="10dp"
android:layout_alignParentRight="true"
android:layout_marginTop="26dp"
android:textSize="14sp"
android:text="#string/txt_resend"
android:textColor="#color/color_505065"
android:background="#android:color/transparent"
android:layout_width="wrap_content"
android:layout_height="40dp" />
<ImageView
android:id="#+id/ic_email"
android:layout_marginLeft="16dp"
android:layout_marginTop="26dp"
android:src="#drawable/ic_email_confirmation_white"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_marginLeft="15dp"
android:layout_toRightOf="#+id/ic_email"
android:layout_toLeftOf="#+id/btn_resend"
android:layout_marginTop="26dp"
android:textSize="14sp"
android:text="#string/text_resend_email"
android:textColor="#android:color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
<RelativeLayout
android:visibility="gone"
android:id="#+id/load"
android:background="#aa000000"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_width="50dp"
android:layout_height="50dp" />
</RelativeLayout>
i don't know why this happen
I don't see anything wrong with your layout hierarchy. Things might be a little weird because you are using an image as a background, and no fixed height and width. I don't know if this is a XML background or a image file, but if it is the latter, I'd recommend using an image view inside the relative layout with a fixed size and a scale type defined.

background is scrolling it should be constant?

I have designed the login layout as follows
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/login_bg">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none">
<LinearLayout
android:id="#+id/login_fields_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dp">
<ImageView
android:id="#+id/loginLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="30dp"
android:src="#drawable/logo" />
<EditText
android:id="#+id/userNameEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:background="#drawable/textfield"
android:drawableLeft="#drawable/username"
android:drawablePadding="10dip"
android:hint="#string/hint_username"
android:imeOptions="actionNext"
android:inputType="textEmailAddress"
android:maxLength="50"
android:padding="10dp"
android:singleLine="true"
android:textColor="#color/login_textcolor"
android:textCursorDrawable="#null" />
<EditText
android:id="#+id/passwordEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#drawable/textfield"
android:drawableLeft="#drawable/password"
android:drawablePadding="10dip"
android:hint="#string/hint_password"
android:imeOptions="actionNext"
android:inputType="textPassword"
android:padding="10dp"
android:singleLine="true"
android:textColor="#color/login_textcolor"
android:textCursorDrawable="#null" />
<LinearLayout
android:id="#+id/loginOptionsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="2">
<CheckBox
android:id="#+id/rememberMeCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="#null"
android:checked="false"
android:drawableEnd="#drawable/bg_checkbox"
android:gravity="center_vertical"
android:paddingRight="40dp"
android:text="#string/text_rememberme"
android:textColor="#color/login_textcolor"
android:textSize="14sp" />
<Button
android:id="#+id/forgotPasswordButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#null"
android:gravity="right|center_vertical"
android:singleLine="true"
android:text="#string/text_forgotpassword"
android:textColor="#color/login_textcolor"
android:textSize="14sp" />
</LinearLayout>
<Button
android:id="#+id/loginButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="#drawable/button_bg"
android:text="#string/text_login"
android:textColor="#android:color/white"
android:textSize="20dp"
android:textStyle="bold" />`
</LinearLayout>
</ScrollView>
</RelativeLayout>
when the i touched on the edittext the background is moving up it need to be constant as it is outside the scrollview.How to solve this issue.
i have referred the following
Background Image Placement
as in this they need in the bottom corner i need it as background.but anyway with curiosity i tried it but still it is scrolling the background
I tried it and it works. Remove the background from xml layout
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE|WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
getWindow().setBackgroundDrawableResource(R.drawable.login_bg) ;
Use the following in your activity
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

Categories

Resources