android - view sliding over layout -


i have relative layout. within have many views edit text, text views , on. lots of animations in that. fine. @ 1 point, have requirement.

it password page. create , confirm password. 2 edittexts 1 after another. if password doesnt meet requirement, plain orange view should slide error message "invalid password".

so put create , confirm password in linear layout. linear layout slide up, letting user type in passwords. after validation, if there error, linear layout should slide down , plain view slide up. kept view invisible , when required made visible , wrote code slide up. same code works when use single edit text instead of linear layout. not working when using linear layout. doing wrong?

adding code it. code specific issue starts till end of coding

i declared linear layout view , not viewgroup.

edit: after doing analysis, found view trying slide after sliding down layout hidden somewhere in view hierarchy.

view.bringtofront() helps bring error view front , slides up.

but after problem is, after linear layout slide down, error view not sliding straight away. because using bringtofront(), displays view first on whole screen (with background color orange) , sliding starts.

i not sure whether correct fixed issue this.

  1. no background color has been given view
  2. i used errorview.bringtofront () , errorview.setvisibility(true) in animationend() of layout slidingdown animation listener.
  3. i defined sliding animation errorview in same animationend() of layout sliding down listener
  4. in animationstart() of errorview sliding animation listener, defined background color of errorview. working expected.

but let me know better way of doing this.

//declaration

view greyview, orangeview, yellowview, blueview, orangeerrorview, letsgetstartedview, welcomebckview, passwordmasterlayout, orangepwderrorview; textview welcometext,errortextview, letsgetstartedtextview, welcomebcktxtview, errorpwdmsg;

//password error handling

    orangepwderrorview = v.findviewbyid(r.id.orangepassworderrorview);     errorpwdmsg = (textview) v.findviewbyid(r.id.errorpasswordmessage); 

//layout code

<linearlayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:id="@+id/sample_main_layout">      <framelayout         android:id="@+id/sample_content_fragment"         android:layout_weight="76.4"         android:layout_width="match_parent"         android:layout_height="0px" />      <framelayout         android:id="@+id/bottompanel"         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="23.6">     </framelayout> </linearlayout> 

sample_content_fragment framelayout takes below code

 <relativelayout     android:layout_height="match_parent"     android:layout_width="match_parent"     xmlns:android="http://schemas.android.com/apk/res/android">      <view         android:id="@+id/grey"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:background="#58595b" />      <view         android:id="@+id/orange"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:background="#f26724"         android:visibility="invisible" />        <view         android:id="@+id/yellow"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:background="#fdb518"         android:visibility="invisible" />      <view         android:id="@+id/blue"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:background="#1893d2"         android:visibility="invisible" />           <textview         android:layout_width="260dp"         android:layout_height="wrap_content"         android:textappearance="?android:attr/textappearancelarge"         android:text="@string/welcome"         android:id="@+id/welcometextview"         android:layout_alignparenttop="true"         android:layout_centerhorizontal="true"         android:layout_margintop="51dp"         android:textcolor="#ffffff"         android:textsize="20dp"         android:textstyle="bold"         android:visibility="invisible"         />      <imageview         android:layout_height="60dp"         android:layout_width="60dp"         android:id="@+id/clinicloud_logo"         android:clickable="true"         android:src="@drawable/clinicloud_icon"         android:layout_marginright="50dp"         android:layout_alignparentstart="true"         android:layout_marginstart="35dp"         android:layout_alignparentbottom="true"         android:layout_marginbottom="40dp" />      <view         android:id="@+id/orangeerrorview"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:background="#f26724"         android:visibility="invisible" />          <edittext         android:layout_width="match_parent"         android:layout_height="90dp"         android:inputtype="textemailaddress"         android:ems="10"         android:id="@+id/emailedittext"         android:text="@string/enter_email"         android:layout_gravity="center"         android:background="#f4f4f4"         android:layout_alignparentbottom="true"         android:layout_alignparentstart="true"         android:visibility="invisible"/>      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:textappearance="?android:attr/textappearancemedium"         android:id="@+id/errormessage"         android:layout_aligntop="@+id/welcometextview"         android:layout_centerhorizontal="true"         android:textcolor="#ffffff"         android:visibility="invisible"/>      <!--ui components welcome page-->      <view         android:id="@+id/welcomebackview"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:background="#134f9f"         android:visibility="invisible" />      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/welcome_back"         android:id="@+id/welcomebacktxtview"         android:textcolor="#ffffff"         android:layout_aligntop="@+id/welcometextview"         android:layout_alignstart="@+id/clinicloud_logo"         android:textsize="20dp"         android:textstyle="bold"         android:visibility="invisible"/>      <edittext         android:layout_width="wrap_content"         android:layout_height="90dp"         android:ems="10"         android:id="@+id/password"         android:layout_aligntop="@+id/emailedittext"         android:layout_alignparentstart="true"         android:layout_alignparentbottom="true"         android:layout_alignparentend="true"         android:text="password"         android:visibility="invisible"         android:background="#d2d1d1"         />       <!--ui components let's started page-->     <view         android:id="@+id/letsgetstartedview"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:background="#5c3a91"         android:visibility="invisible" />      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="let&apos;s started"         android:id="@+id/letsgetstartedtxtview"         android:textcolor="#ffffff"         android:layout_aligntop="@+id/welcometextview"         android:layout_alignstart="@+id/clinicloud_logo"         android:textsize="20dp"         android:textstyle="bold"         android:visibility="invisible"/>    <!--linear layout show create , confirm password-->       <linearlayout         android:orientation="vertical"         android:layout_width="match_parent"         android:layout_height="180dp"         android:gravity="bottom"         android:layout_alignbottom="@+id/emailedittext"         android:layout_alignparentstart="true"         android:weightsum="1"         android:id="@+id/passwordmasterview"         android:visibility="invisible">          <edittext             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:inputtype="text"             android:id="@+id/createpwd"             android:layout_weight="0.50"             android:background="#f4f4f4"             android:text="@string/create_password"             />          <edittext             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:inputtype="text"             android:id="@+id/confirmpwd"             android:layout_weight="0.50"             android:background="#e3e3e3"             android:text="@string/confirm_password" />     </linearlayout>      <!-- show password errors-->      <linearlayout         android:id="@+id/orangepassworderrorview"         android:orientation="horizontal"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:background="#f26724"         android:visibility="invisible" />      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:textappearance="?android:attr/textappearancemedium"         android:id="@+id/errorpasswordmessage"         android:layout_aligntop="@+id/welcometextview"         android:layout_centerhorizontal="true"         android:textcolor="#ffffff"         android:visibility="invisible"         />      <!-- show password errors-->  </relativelayout> 

the java logic in https://stackoverflow.com/questions/30523599/sliding-up-and-down-android

please direct incorrect codings

i kept view invisible , when required made visible , wrote code slide up.

i think must in dialogfragment or custom alertdialog shown above layout, if dont want try envelop relativelayout in framelayout , adding in linearlayout example visout code difficult in problem is


Comments

  1. Yeah, choosing android application developmentis one of the beneficial decisions for the business. It is actually very helpful for the enhancement of the business as it helps to increase brand visibility and much more. Can you give me good suggestions to hire capable app developers for my company?

    ReplyDelete

Post a Comment

Popular posts from this blog

Java 3D LWJGL collision -

methods - python can't use function in submodule -

c# - ErrorThe type or namespace name 'AxWMPLib' could not be found (are you missing a using directive or an assembly reference?) -