The label hint color doesnt works, i created the color Bluesky, but only works with the linear box but the label dont.
<android.support.design.widget.TextInputLayout
android:id="#+id/til1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="14dp"
android:layout_marginEnd="0dp"
android:layout_weight=".8"
android:textColorHint="#color/BlueSky"
app:boxStrokeColor="#color/BlueSky"
app:counterEnabled="true"
app:counterMaxLength="7"
app:errorEnabled="true"
app:hintEnabled="true">
<android.support.design.widget.TextInputEditText
android:id="#+id/tid1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="9dp"
android:elevation="7dp"
android:hint="Test"
android:inputType="number|numberDecimal"
android:maxLength="7"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
mi build gradle:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-
layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation'com.android.support.test.espresso:espresso-core:3.0.2'
}
I use the version 3.4 of android studio.
the label color on the input layout is the colorAccent of your project. If you change this color to BlueSky you'll see what you want.
<color name="colorAccent">#D81B60</color>
But maybe there's another way to style this widget without changing the colorAccent (because this color is used by other widgets too).
Related
I have been trying different solutions without success to remove the yellow paint of autocomplete on textfield.
I tried 3 different ways to use:
<item name="android:autofilledHighlight">#android:color/transparent</item>
tried in version v26, with tools:targetApi="o" and tools:ignore="NewApi". Also tried the solution on developers.android to create a transparent shape.
This is my style:
<style name="editText" parent="Theme.AppCompat">
<item name="android:autofilledHighlight" tools:ignore="NewApi">#color/transparent</item>
<item name="colorControlNormal">#color/lightGray</item>
<item name="colorPrimary">#color/darkGray</item>
<item name="colorPrimaryDark">#color/lightGray2</item>
<item name="colorAccent">#color/mainOrange</item>
</style>
this is my EditText:
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/login_emailinputlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/editText"
android:layout_marginStart="55dp"
android:layout_marginLeft="55dp"
android:layout_marginTop="55dp"
android:layout_marginEnd="55dp"
android:layout_marginRight="55dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView5">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/login_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:theme="#style/editText"
android:textCursorDrawable="#drawable/cursor"
app:backgroundTint="#color/mainOrange" />
</com.google.android.material.textfield.TextInputLayout>
This is my gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.android.volley:volley:1.1.1'
}
Everything works except the autocomplete yellow paint. Any help will be much appreciated.
This question already has answers here:
How to add cardview in layout xml in AndroidX
(10 answers)
Closed 3 years ago.
I am following this tutorial for Android app :
https://www.youtube.com/watch?v=wW-AAXOy4u4
I added a list that may contain some items; For each item, I want it to be a Card. Created the card, imported dependencies in build.gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.squareup:android-times-square:1.6.5#aar'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.google.android.material:material:1.2.0-alpha01'
implementation 'androidx.cardview:cardview:1.0.0'
}
as suggested here:
android.support.v7.widget.CardView could not be found (Android Studio 1.1 Preview)
Nevertheless, I still get the "android.support.v7.widget.CardView could not be found" error.
The error that I get:
The following classes could not be found:
- android.support.v7.widget.CardView (Fix Build Path, Edit XML, Create
Class)
Tip: Try to build the project. Tip: Try to refresh the layout.
Here is my main_activity_single_item code:
<android.support.v7.widget.CardView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:background="#color/colorAccent"
android:elevation="4dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="80dp"
android:layout_height="105dp"
android:id="#+id/ivMain"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tvMain"
android:textStyle="bold"
android:layout_toRightOf="#+id/ivMain"
android:layout_marginLeft="6dp"
android:layout_toEndOf="#+id/ivMain"
android:text="Timetable"
android:textSize="24sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tvDescription"
android:layout_below="#+id/tvMain"
android:layout_toRightOf="#+id/ivMain"
android:layout_marginLeft="6dp"
android:text="Description"
android:textSize="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tvClick"
android:textSize="12dp"
android:text="click here"
android:layout_below="#+id/tvDescription"
android:layout_alignBottom="#+id/ivMain"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
What I already tried:
changed in
res->value->styles
from <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
to <style name="AppTheme" parent="Base.Theme.AppCompat.Light.NoActionBar">
(error)
File .. Invalidate caches / restart
Build project
I work on Android Studio, my API version is 22
Can you please, share your insights on this issue ?
Please let me know if you need some extra information.
Thank you very much.
Either use
androidx.cardview.widget.CardView
or
com.google.android.material.card.MaterialCardView
instead of
android.support.v7.widget.CardView
I'm just trying to use the group view with the android constraint layout to set the visibility of several views more easily. Problem is even though I change the visibility of a group to gone or invisible it does not do anything.
I'v already tried the steps of Pavan's response in this thread: toggle visibility of chain group in constraint layout.
But it didn't change anything for me. (I assume it's because I'm not using the beta version)
Here is my dependencies app gradle file
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
This is an extract of my XML file with the group
<Button
android:text="#string/action_update"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/button_update"
android:layout_marginBottom="32dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp" android:layout_marginRight="8dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp" app:layout_constraintStart_toStartOf="parent" android:textSize="18sp"/>
<android.support.constraint.Group android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="#+id/group"
android:visibility="gone"
app:constraint_referenced_ids="button_update"/>
You are importing the Group widget from a wrong package.
Change
<android.support.constraint.Group
To
<androidx.constraintlayout.widget.Group
Updated Version
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
..............................................
>
<Button
android:id="#+id/button_update"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="32dp"
android:text="#string/action_update"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<androidx.constraintlayout.widget.Group
android:id="#+id/group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="button_update" />
</androidx.constraintlayout.widget.ConstraintLayout>
The thing is I didn't notice that when I created my android studio project, i didn't check the box "Use androidx artifacts" which automatically makes your project use the new androidx library. Androidx tends to replace the support library (See more details here: https://developer.android.com/jetpack/androidx)
So basically, I followed the steps given here to convert my project to androidx and now everything is working perfectly.
Thank for your time #theapache64, now your code is working.
I recently updated my support library to com.android.support:appcompat-v7:25.1.0 after which if I add a text to EditText via xml file the TextInputLayout hint doesn't float up.
I also had a look at this question but it didn't worked for me.
Here is my xml code:
<android.support.design.widget.TextInputLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp"
app:layout_constraintVertical_bias="0.0"
android:id="#+id/til1"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp"
app:layout_constraintHorizontal_bias="0.33">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="From"
android:inputType="time"
android:text="09:00 AM"
android:id="#+id/from_mon"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
Here is my gradle dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.bhargavms:DotLoader:1.0.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.labo.kaji:fragmentanimations:0.1.1'
compile 'com.github.esafirm.android-image-picker:imagepicker:1.2.5'
testCompile 'junit:junit:4.12'
}
This is the problem
You can clearly see that the hint is floating up.
Please guide.
You must provide hint to the TextInputLayout and use TextInputEditText instead of EditText
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="From">
<android.support.v7.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="09:00 AM" />
</android.support.design.widget.TextInputLayout>
After updating to version 25.1.0 of the v7 appcompat library, I faced many serious bugs in Toolbar, RecyclerView, etc.
I went back to version 25.0.1.
UPDATE:
The issue was fixed in 25.3.1
It is a bug in 25.1.0
https://code.google.com/p/android/issues/detail?id=230171
It seems we have to use previous 25.0.1 version for now.
#Rahul Sharma,
Why you are using android:hint="From" and android:text="09:00 AM" in EditText tag of xml file?
Instead of that you can use only android:hint="From in xml file and In Java code u can set text in dynamically.
I hope u will get my point.
Thanks.
This issue is fixed in Support Library Version 25.2.0. Please update to 25.2.0
This update includes other major fixes.
https://developer.android.com/topic/libraries/support-library/revisions.html#25-2-0
Check your Do changes like this in you build.gradle for dependencies ..
I think gradle is not a problem
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
}
If not solve by changes of gradle change First check basic changes in you inpul layout .. it will defiantly do your text float.. after do your changes.
<android.support.design.widget.TextInputLayout
android:id="#+id/til1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:layout_margin="10dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="From"
android:inputType="time"
android:text="09:00 AM"
android:id="#+id/from_mon"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
NOTE: And if possible set your hint in to string file .. may that will also be the issue.
I recently updated my support library to com.android.support:appcompat-v7:25.1.0 after which if I add a text to EditText via xml file the TextInputLayout hint doesn't float up.
I also had a look at this question but it didn't worked for me.
Here is my xml code:
<android.support.design.widget.TextInputLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp"
app:layout_constraintVertical_bias="0.0"
android:id="#+id/til1"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp"
app:layout_constraintHorizontal_bias="0.33">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="From"
android:inputType="time"
android:text="09:00 AM"
android:id="#+id/from_mon"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
Here is my gradle dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.bhargavms:DotLoader:1.0.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.labo.kaji:fragmentanimations:0.1.1'
compile 'com.github.esafirm.android-image-picker:imagepicker:1.2.5'
testCompile 'junit:junit:4.12'
}
This is the problem
You can clearly see that the hint is floating up.
Please guide.
You must provide hint to the TextInputLayout and use TextInputEditText instead of EditText
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="From">
<android.support.v7.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="09:00 AM" />
</android.support.design.widget.TextInputLayout>
After updating to version 25.1.0 of the v7 appcompat library, I faced many serious bugs in Toolbar, RecyclerView, etc.
I went back to version 25.0.1.
UPDATE:
The issue was fixed in 25.3.1
It is a bug in 25.1.0
https://code.google.com/p/android/issues/detail?id=230171
It seems we have to use previous 25.0.1 version for now.
#Rahul Sharma,
Why you are using android:hint="From" and android:text="09:00 AM" in EditText tag of xml file?
Instead of that you can use only android:hint="From in xml file and In Java code u can set text in dynamically.
I hope u will get my point.
Thanks.
This issue is fixed in Support Library Version 25.2.0. Please update to 25.2.0
This update includes other major fixes.
https://developer.android.com/topic/libraries/support-library/revisions.html#25-2-0
Check your Do changes like this in you build.gradle for dependencies ..
I think gradle is not a problem
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
}
If not solve by changes of gradle change First check basic changes in you inpul layout .. it will defiantly do your text float.. after do your changes.
<android.support.design.widget.TextInputLayout
android:id="#+id/til1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:layout_margin="10dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="From"
android:inputType="time"
android:text="09:00 AM"
android:id="#+id/from_mon"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
NOTE: And if possible set your hint in to string file .. may that will also be the issue.