android


InputType textpassword in TextInputLayout


I have created a form in the android app. It looks something like this.
What I want is the text appearance in all the hints to be cosistent. If I use inputType = "textpassword" it gives the effect of confirm password which is different(bold) from other view. The field password has also same input type but the editext is not inside textInputlayout. The code for fields are as follows
1>password field
<EditText
android:id="#+id/registerPasswordEt"
fontPath="fonts/Proxima_Nova_Light.ttf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password *"
android:fontFamily="sans-serif"
android:textStyle="normal"
android:inputType="textPassword"
android:maxLines="1"
android:nextFocusDown="#+id/registerConfirmPasswordEt" />
2> Confirm password
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_confirm_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/input_layout_password">
<EditText
android:id="#+id/registerConfirmPasswordEt"
fontPath="fonts/Proxima_Nova_Light.ttf"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="sans-serif"
android:hint="Confirm Password ( must match password ) *"
android:inputType="textPassword"
android:maxLines="1"
android:nextFocusDown="#+id/registerUserNameEt"
android:textStyle="normal" />
</android.support.design.widget.TextInputLayout>
3> Other field
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_last_name"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/registerLastNameEt"
fontPath="fonts/Proxima_Nova_Light.ttf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Last Name *"
android:inputType="textPersonName"
android:maxLines="1"
android:nextFocusDown="#+id/registerPasswordEt" />
</android.support.design.widget.TextInputLayout>
What I want is all texts to look similar and I need TextInputLayout for animation effects. Is there a way to make the text appearance same?
I put your code and it shows confirm password field same as other fields... I am posting code below, correct me If I am wrong (fontPath lib is not used in this code)...
Screenshot
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_confirm_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/inputLayout">
<EditText
android:id="#+id/registerConfirmPasswordEt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="sans-serif"
android:hint="Confirm Password ( must match password ) *"
android:textColor="#color/white"
android:inputType="textPassword"
android:maxLines="1"
android:nextFocusDown="#+id/registerUserNameEt"
android:textStyle="normal" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_last_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/inputLayout">
<EditText
android:id="#+id/registerLastNameEt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Last Name *"
android:inputType="textPersonName"
android:maxLines="1"
android:nextFocusDown="#+id/registerPasswordEt" />
</android.support.design.widget.TextInputLayout>
Remove inputType from editText from xml file and add following line in your java code :
EditText registerConfirmPasswordEt = (EditText) findViewById(R.id.registerConfirmPasswordEt_text);
registerConfirmPasswordEt.setTransformationMethod(new PasswordTransformationMethod());
The issue is because of the library calligraphy. Above issue occurs when you have calligraphy library and edittext with inputtype textpassword inside TextInputLayout. The solution I found are as follows.
Typeface confirmPasswordFace = Typeface.createFromAsset(getAssets(), CalligraphyConfig.get().getFontPath());
inputLayoutConfirmPassword.setTypeface(confirmPasswordFace); // or Typeface.NORMAL or any other
CalligraphyTypefaceSpan confrmPasswordTypefaceSpan = TypefaceUtils.getSpan(confirmPasswordFace);
SpannableString spannableConfirmPasswordHint = new SpannableString("Confirm Password ( must match password ) *");
spannableConfirmPasswordHint.setSpan(confrmPasswordTypefaceSpan, 0, spannableConfirmPasswordHint.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
inputLayoutConfirmPassword.setHint(spannableConfirmPasswordHint);

Related Links

Top Border in Android Text View
how to notify from B activity to A that list data has been changed?
Webview postUrl , loading animation issue in Android
Why does the native heap memory increases constantly on an orientation change?
android text view text in vertical direction
VideoView-To Play swf file
Use Preferences to get SharedPrefernces
Strange Behaviour of Async Task code in android
Android: Scrollbars to appear below the component instead of on the component
Android: PNG Transparency Failing with BitmapFactory.decodeStream(…) and Assets Folder
android layoutinflater NullException
Swap two fragment simultaneously
Is it possible to add an image in sqlite database from command line? If yes, how is it done?
Why my Image Quality is not good while sending it to server in My Android App?
is it wrong? TextView displayTextView = (TextView)findViewById(R.id.DisplayTextView);
How to edit AndroidManifest.xml file?

Categories

HOME
design-patterns
developer-tools
c99
apache-flink
object
datastore
apache-spark-mllib
solaris
replace
nested-if
trac
nfs
character
sendgrid-api-v3
project
categorical-data
drop-down-menu
filechannel
gource
event-sourcing
shortest-path
cfml
undertow
ksh
r-mice
string-concatenation
interpreter
apktool
firebase-analytics
inversion-of-control
soot
quantlib
user-defined-functions
browser-sync
twiml
cart
playstation-portable
laravel-eloquent
spring-security4
gojs
gnat-gps
installshield-le
numpy-broadcasting
docfx
openproject
sql-server-ce
opensmpp
spring-mvc-test
numberpicker
congestion-control
apollostack
apache-spark-dataset
uiimage
snapchat
fwrite
nanoc
libgphoto2
serde
spring-integration-sftp
mschart
facebook-pixel
activeperl
manova
jqchart
flac
cd-burning
jtree
bootstrap-tags-input
docpad
pytables
webjars
myspace
tinkerpop3
nservicebus5
cassia
kango-framework
redis-cluster
jparsec
state-restoration
custom-errors
dynatree
iokit
ess
canalyzer
sony-lifelog-api
snoop
crowd
appserver
psr-4
live555
malformedurlexception
windows-embedded-standard
scriptaculous
light
merb
qi4j
subgraph
correlated-subquery
extconf.rb
entitydatasource
cuteeditor
appledoc
twitterizer
globals
jqueryform
eclipse-marketplace
sqlobject
lemmatization
commercial-application
great-circle

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App