<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>how to show and hide password in android using eye icon &#8211; MaXEster Technologies  | Technical Blog</title>
	<atom:link href="https://www.maxester.com/blog/tag/how-to-show-and-hide-password-in-android-using-eye-icon/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.maxester.com/blog</link>
	<description>Tutorials, Examples and Implementation code for Developers Help</description>
	<lastBuildDate>Mon, 17 Feb 2025 09:17:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.22</generator>
	<item>
		<title>Show/Hide Password in EditText in Android</title>
		<link>https://www.maxester.com/blog/2019/05/28/show-hide-password-in-edittext-in-android/</link>
		<comments>https://www.maxester.com/blog/2019/05/28/show-hide-password-in-edittext-in-android/#comments</comments>
		<pubDate>Tue, 28 May 2019 12:27:52 +0000</pubDate>
		<dc:creator><![CDATA[Jony Chawla]]></dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[android show password edittext]]></category>
		<category><![CDATA[how to show and hide password in android using eye icon]]></category>
		<category><![CDATA[show/hide password]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=380</guid>
		<description><![CDATA[<p>To show/hide password in android simply change the attribute dynamically android:inputtype = "textpassword" or "text" using this setTransformationMethodFull code definition is below for show and hide password in edittext Here one edittext with input type = password and one eye&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/05/28/show-hide-password-in-edittext-in-android/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/05/28/show-hide-password-in-edittext-in-android/">Show/Hide Password in EditText in Android</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-preformatted">To show/hide password in android simply change the attribute dynamically  <br><a href="https://developer.android.com/reference/android/widget/TextView.html#attr_android:password">android:inputtype</a> = "textpassword" or "text" using this <a href="https://developer.android.com/reference/android/widget/TextView.html#setTransformationMethod(android.text.method.TransformationMethod)">setTransformationMethod</a><br><br>Full code definition is below for show and hide password in edittext <br><br></pre>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>//Show Password
edit_password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());

//Hide Password
edit_password.setTransformationMethod(PasswordTransformationMethod.getInstance());</code></pre>



<p>Here one edittext with input type = password and one eye toggle ImageView button. We have to manage show/hide password using this Imageview onClick Action. </p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>                    &lt;RelativeLayout
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp10">

                    &lt;EditText
                        android:id="@+id/edit_password"
                        android:layout_width="fill_parent"
                        android:layout_height="@dimen/dp45"
                        android:background="@drawable/edittext_bg"
                        android:hint="@string/employeelogin_form_password"
                        android:inputType="textPassword"
                        android:paddingLeft="@dimen/dp10"
                        android:paddingTop="@dimen/dp10"
                        android:paddingRight="@dimen/dp40"
                        android:paddingBottom="@dimen/dp10"
                        android:text=""
                        android:textColor="@color/postjob_bg"
                        android:textSize="@dimen/dp13" />

                    &lt;ImageView
                        android:id="@+id/show_pass_btn"
                        android:layout_width="@dimen/dp40"
                        android:layout_height="@dimen/dp40"
                        android:layout_alignParentRight="true"
                        android:layout_centerVertical="true"
                        android:layout_marginRight="@dimen/dp5"
                        android:alpha=".5"
                        android:onClick="ShowHidePass"
                        android:padding="@dimen/dp5"
                        android:src="@drawable/show_password" />
                &lt;/RelativeLayout></code></pre>



<p>This is layout preview of Password Editext with Eye Icon On right</p>



<div class="wp-block-image"><figure class="aligncenter is-resized"><img src="https://www.maxester.com/blog/wp-content/uploads/2019/05/Show-Hide-Password-Editext-In-Andriod-1.png" alt="" class="wp-image-393" width="307" height="390" srcset="https://www.maxester.com/blog/wp-content/uploads/2019/05/Show-Hide-Password-Editext-In-Andriod-1.png 310w, https://www.maxester.com/blog/wp-content/uploads/2019/05/Show-Hide-Password-Editext-In-Andriod-1-236x300.png 236w" sizes="(max-width: 307px) 100vw, 307px" /></figure></div>



<p>In Imageview Tag XML we simply add Attribute android:onClick=&#8221;ShowHidePass&#8221; for calling onclick function  <br>ShowHidePass() directly in code</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>public void ShowHidePass(View view){

        if(view.getId()==R.id.show_pass_btn){

        if(edit_password.getTransformationMethod().equals(PasswordTransformationMethod.getInstance())){
        ((ImageView(view)).setImageResource(R.drawable.hide_password);

        //Show Password                 
        edit_password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
        }
        else{
        ((ImageView)(view)).setImageResource(R.drawable.show_password);

        //Hide Password
        edit_password.setTransformationMethod(PasswordTransformationMethod.getInstance());

        }
        }
        }</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/05/28/show-hide-password-in-edittext-in-android/">Show/Hide Password in EditText in Android</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/05/28/show-hide-password-in-edittext-in-android/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
