TextInputLayout in Sketchware

To create an EditText with animation features, we can use the EditText in a TextInputLayout which is a Layout interface in android.support.design.widget library. In Sketchware we cannot add it in xml file but we can create it programmatically. Follow the instructions given below for a simple example.


1. In VIEW area of your project add a Linear vertical linear7 and inside this add three EditText fields edit_email, edit_username, and edit_password. For the three EditText fields set hint as Email, Username and Password respectively.


2. Switch On AppCompat and design.

3. In onCreate event,
i. Use codes to remove all Views from linear7.
linear7.removeAllViews();

ii. Define a TextInputLayout textinput1, and add edit_email to it.
com.google.android.material.textfield.TextInputLayout textinput1 = new com.google.android.material.textfield.TextInputLayout(this);


textinput1.addView(edit_email);

iii. Define a TextInputLayout textinput2, and add edit_username to it.
com.google.android.material.textfield.TextInputLayout textinput2 = new com.google.android.material.textfield.TextInputLayout(this);


textinput2.addView(edit_username);

iv. Define a TextInputLayout textinput3, and add edit_password to it.
com.google.android.material.textfield.TextInputLayout textinput3 = new com.google.android.material.textfield.TextInputLayout(this);


textinput3.addView(edit_password);

textinput3.setHelperTextEnabled(true);

textinput3.setHelperText("Password must be at least 7 characters in length");

v. Add all TextInputLayouts to linear7.
linear7.addView(textinput1);
linear7.addView(textinput2);
linear7.addView(textinput3);

4. Save and run the project.


Comments

  1. What to do?
    This error is showing !!

    1. ERROR in /storage/emulated/0/.sketchware/
    mysc/610/app/src/main/java/com/my/newproject3/
    MainActivity.java (at line 68)
    android.support.design.widget. TextInputLayout
    extinput1 = new
    android.support.design.widget. TextInputLayout(this);
    AAAAAAAAAAAAAAA
    android.support cannot be resolved to a type

    ReplyDelete
  2. How to add show/hide password button in textinputlayout ?

    ReplyDelete
  3. Hello sir, thanks for making tutorials so intuitive and useful.
    How can a ProgressDialog be used together with a WebView?
    code:

    ProgressDialog dialog = new ProgressDialog (this);
    dialog.setTitle ("Title");
    dialog.setMessage ("Message");
    dialog.setProgressStyle (ProgressDialog.STYLE_SPINNER);

    dialog.show ();

    ReplyDelete
  4. Error in /storage/emulated/0/.sketchware/mysc/613/app/scr/main/java/com/my/newproyect6/MainActivity.java (at line 109 )

    EditText edittext1, edittext2;
    ^^^^^^^^^
    Duplicate field MainActivity.edittext2

    ReplyDelete
    Replies
    1. The person above did not have app compact and design switched on...it had the kind of same error try it

      Delete
  5. Legend, keep-up the good work :)

    ReplyDelete
  6. how to change the color of the hint text???

    ReplyDelete
  7. how can i make a sticker injector in my poster maker app

    ReplyDelete
  8. Holaa q as ago for q when I register the name appears with the q I registered in another activity. Thanks, I hope your answers

    ReplyDelete
  9. /storage/emulated/0/.sketchware/mysc/620/ app/src/main/res/layout/dissc.xml:38: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/pp1'), /storage/ emulated/0/.sketchware/mysc/620/app/src/main/ res/layout/dissc.xml:57: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/pp1'), , /storage/emulated/0/.sketchware/ mysc/620/app/src/main/res/layout/groupe.xml: 22: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/pp1'), ,/ storage/emulated/0/.sketchware/mysc/620/app/src/ main/res/layout/image.xml:8: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/pp1'), , /storage/emulated/0/.sketchware/ mysc/620/app/src/main/res/layout/login2.xml: 16: error: Error: No resource found that matches the given name (at 'src' with value '@drawable/signin')., , / storage/emulated/0/.sketchware/mysc/620/app/src/ main/res/layout/main.xml:63: error: Error: No resource found that matches the given name (at 'src' with value @drawable/pp1')., , /storage/emulated/0/.sketchware/ mysc/620/app/src/main/res/layout/user.xml:8: error: Error: No resource found that matches the given name (at 'background' with value @drawable/spl),,/ storage/emulated/0/.sketchware/mysc/620/app/src/ main/res/layout/vgp.xml:15: error: Error: No resource found that matches the given name (at 'src' with value @drawable/pp1'), . /storage/emulated/0/.sketchware/ mysc/620/app/src/main/res/layout/vue.xml:69: error: Error: No resource found that matches the given name (at 'src' with value @drawable/pp1').,] wgar how solve that?

    ReplyDelete
  10. Hey Bro I'm Adnan And I Need Your Help You Can talk me , how to choose videos from filePicker With (Limited Mb Or kB)
    Example (20Mb)..
    I told you more than once, But You Don't
    HELP ME..


    Please Bro Help Me!!!

    ReplyDelete

Post a Comment

Popular posts from this blog

Create Music Player app in Sketchware

A Flash Light App in Sketchware

Simple car racing android game in Sketchware

Firebase auth in Sketchware for Login Activity

Admob rewarded video Ads in Sketchware