AutoCompleteTextView strange behaviour in LolliPop Device - android

I am using AutoCompleteTextView in my layout. But it's colorControlNormal and Activate is not Working as I expected.
My Color value is #0072BA.
Below is figure for Different Device.
1.) Android Kitkat
2.) Android LolliPop
3.) Android Marshmallow
Xml code that i used is below
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/md_black_1000"
android:layout_marginTop="5dp"
android:textSize="15sp"
android:text="Medical Store Name"
android:textColorHint="#999999"
android:layout_below="#+id/search_drug_store"
android:id="#+id/autoCompleteTextView_storename"
android:layout_marginLeft="15dp"
android:layout_marginRight="10dp"/>
<AutoCompleteTextView
android:id="#+id/autoCompleteTextView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:textSize="12sp"
android:textColor="#999999"
android:layout_below="#+id/autoCompleteTextView_storename"
android:layout_marginLeft="25dp"
android:inputType="textNoSuggestions"
android:layout_marginRight="10dp"/>
I am not giving any style to AutoCompleteTextView then Why it's Happening ?
What I Have Try :
If i give this Style
Reference Material Design link :
http://www.materialdoc.com/autocomplete-view/
and give this style
<style name="Autocomplete" parent="Widget.AppCompat.Light.AutoCompleteTextView">
<item name="android:background">#color/green500</item>
<item name="colorControlNormal">#color/amber500</item>
<item name="colorControlActivated">#color/cyan500</item>
</style>
But in Lollipop nothing has Change.
Is this bug in lollipop version or i am doing something wrong ?

actually this is not solution to this problem but you can use this for unique design all over device.
i have implemented for edittext like this in xml,set background null for edittext and add horizontal line below edittext.
<EditText
android:id="#+id/newPasswordEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="#dimen/activity_horizontal_margin"
android:layout_marginLeft="#dimen/activity_horizontal_margin"
android:background="#null"
android:textColor="#color/color_black"
android:inputType="textPassword"
android:layout_marginBottom="10dp"
android:hint="Enter New Password"
android:layout_marginTop="10dp"
android:textSize="14sp"
android:layout_below="#+id/titleTextView" />
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="2dp"
android:orientation="horizontal"
android:layout_marginBottom="7dp"
android:layout_marginLeft="#dimen/activity_horizontal_margin"
android:layout_marginRight="#dimen/activity_horizontal_margin"
android:layout_below="#+id/newPasswordEditText"
android:background="#color/color_standard_green" />

There is no bug in lollipop version you just not override the style of theme with your style,use in this way https://stackoverflow.com/a/26631227/4745569

Related

Remove top and bottom black borders from AutoCompleteTextView

I'm experiencing a problem with the AutoCompleteTextView dropdown component.
As you can see from the image below, there are those black borders inside the popup that I cannot get rid of.
Black borders:
I'm an Android noob, and I already tried basically everything with any success.
Below the code, I'm using.
activity.xml:
<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:hint="Categoria"
android:layout_marginRight="#dimen/spacing_xlarge"
app:hintEnabled="true"
app:boxBackgroundColor="#color/white"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu">
<AutoCompleteTextView
android:dropDownSelector="#color/white"
android:id="#+id/private_place_dropdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:dropDownHeight="300dp"
android:inputType="none"
android:drawableTint="#color/white"
android:backgroundTint="#color/white"
android:editable="false"
android:textColor="#color/piumaBaseColor"
/>
</com.google.android.material.textfield.TextInputLayout>
dropdown_menu_popup_item.xml:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:paddingLeft="#dimen/spacing_medium"
android:paddingRight="#dimen/spacing_medium"
android:paddingBottom="#dimen/spacing_medium"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="#style/TextAppearance.MaterialComponents.Body1"
android:gravity="center_vertical"
android:background="#color/white"
android:backgroundTint="#color/white"
android:textColor="#color/grey_extradark"
android:text="test"/>
Can you please help me? Thank you a lot!
This dark lined are additional background from PopupBackgroundView. For fix the issue just use for background the same surfaceColor as you have in your theme
<style name="AppTheme" parent="Theme.MaterialComponents.Light">
...
<item name="colorSurface">#FFFFFF</item>
</style>

android I set fontface such as songti.ttc,but my textview setting is gravity=“center” ,as result ,it does not work on android 5.0 lollipop

android I set fontface such as songti.ttc,but my textview setting is gravity=“center” ,as result ,it does not work on Android 5.0 lollipop,how can I fix it?
<TextView
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:background="#drawable/special_layer_list_back"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:textColor="#fff"
android:textSize="18sp"
android:textStyle="bold|italic" />

Remove underline from TextView which uses Widget.EditText style

I have a TextView for showing user's wallet balance in my app. In order to set error indicator on low balance I added Widget.EditText style to the TextView. My issues is after adding this style, the TextView is showing an under line. How can I remove that underline?
My TextView
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/hm_bal"
android:textColor="#color/primary_dark"
android:textSize="14sp"
android:textStyle="bold"
android:layout_gravity="left"
android:padding="3dp"
android:gravity="top"
android:text="----"
style="#android:style/Widget.EditText" />
I don't want to change the style since using this theme was perfect for my requirement except the underline.
Try to set transparent background in your textview
android:background="#android:color/transparent"
LIKE
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/hm_bal"
android:textColor="#color/colorPrimaryDark"
android:textSize="14sp"
android:textStyle="bold"
android:layout_gravity="left"
android:padding="3dp"
android:gravity="top"
android:text="----"
android:background="#android:color/transparent"
style="#android:style/Widget.EditText" />
set background null
android:background="#null"

Android bypassing theme setting

I have a Layout with a TextView in an application - not written by me. I want to set it to bold or change the font family in the xml. In the application written by me it works correctly. But in this one, the change doesn't show. I suppose that's because a theme was applied. If I change the setting programmatically it works and if I set it to bold programmatically it works.
myTextView.Typeface(Typeface.DEFAULT_BOLD).
How can I overwrite the theme setting?
UPDATE:
The Layout that i have is this:
<LinearLayout
android:id="#+id/lFiltro"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10sp"
android:layout_marginEnd="10sp"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:id="#+id/tUno"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="#font/archivo_black"
android:shadowColor="#33b5e5"
android:shadowDx="4"
android:shadowDy="4"
android:shadowRadius="5"
android:text="This is my text"
android:textAlignment="center"
android:textColor="#0000ff"
android:textSize="24sp"
android:textStyle="bold"
android:visibility="visible" />
</LinearLayout>
Try to add
android:textAppearance="#style/TextAppearance.AppCompat.Subhead"
to your TextView xml and change what is after TextAppearance. according to the suggestions you will get.

Custom RatingBar Shows different number of stars when on api 23

When setting RatingBar in xml file and set android:drawableProgress to custom drawable I've created (as described here) it shows 5 stars in the preview screen of android studio with api 22 but when I set the api target to api 23 it shows 1 star but the ratingbar (android:width="wrap_content") is at the same width as it is with 5 stars. This is also checked on cellular phones with Lollipop and marshmallow OS (Same behavior as described).
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="#dimen/spacing_standard"
android:orientation="vertical"
android:background="#color/sfly_orange"
android:fillViewport="true">
<com.shutterfly.android.commons.common.ui.TypefacedTextView
android:id="#+id/thank_you_label_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/order_confirmation_thank_you"
android:textColor="#android:color/white"
android:textSize="#dimen/rate_app_text_size_largest"
android:gravity="center"
app:typeface="medium"
android:layout_marginTop="#dimen/spacing_standard"/>
<ImageView
android:layout_width="#dimen/rate_app_image_width"
android:src="#drawable/rate_icon"
android:layout_gravity="center_horizontal"
android:layout_marginTop="#dimen/rate_app_spacing_standard"
android:layout_height="#dimen/rate_app_image_height"/>
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/rate_app_spacing_standard">
<com.shutterfly.android.commons.common.ui.TypefacedTextView
android:id="#+id/order_number_label_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
app:typeface="medium"
android:text="#string/order_confirmation_order_number_label"
android:textColor="#android:color/white"
android:textSize="#dimen/rate_app_text_size_normal"/>
<com.shutterfly.android.commons.common.ui.TypefacedTextView
android:id="#+id/order_number_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
app:typeface="medium"
android:layout_marginTop="#dimen/spacing_standard"
android:textColor="#android:color/white"
android:textSize="#dimen/rate_app_text_size_larger"/>
<com.shutterfly.android.commons.common.ui.TypefacedTextView
android:id="#+id/order_confirmation_details_label_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/order_confirmation_details_label"
android:layout_marginTop="#dimen/spacing_standard_large"
android:textAlignment="center"
android:lineSpacingExtra="#dimen/rate_app_text_line_spacing"
android:gravity="center"
app:typeface="oblique"
android:textColor="#android:color/white"
android:textSize="#dimen/rate_app_text_size_normal"
tools:ignore="UnusedAttribute"/>
<RatingBar
android:id="#+id/rate_app_rating_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/rate_app_spacing_standard"
android:numStars="#integer/rating_bar_number_of_stars"
android:stepSize="#integer/rating_bar_step"
android:minHeight="#dimen/button_height"
android:maxHeight="#dimen/button_height"
style="?android:attr/ratingBarStyle"
android:layout_gravity="center"
android:progressDrawable="#drawable/rating_bar_star_style"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:layout_marginTop="#dimen/rate_app_spacing_standard">
<com.shutterfly.android.commons.common.ui.TypefacedTextView
android:id="#+id/rate_app_button"
android:layout_width="#dimen/button_width"
android:layout_height="#dimen/button_height"
android:gravity="center"
android:background="#drawable/button_white_background"
android:paddingLeft="#dimen/spacing_standard"
android:paddingRight="#dimen/spacing_standard"
android:text="#string/rate_shutterfly"
android:textAllCaps="true"
android:textColor="#color/sfly_orange"
android:textSize="#dimen/rate_app_text_size_normal_larger"
app:typeface="medium"/>
<com.shutterfly.android.commons.common.ui.TypefacedButton
android:id="#+id/return_to_store_button"
android:layout_width="#dimen/button_width"
android:layout_height="#dimen/button_height"
android:paddingLeft="#dimen/spacing_standard"
android:layout_marginTop="#dimen/spacing_standard"
android:layout_gravity="bottom|center_horizontal"
android:paddingRight="#dimen/spacing_standard"
android:text="#string/order_confirmation_return_to_store"
style="?android:attr/borderlessButtonStyle"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="#dimen/rate_app_text_size_normal"
app:btnTypeface="medium"
android:layout_marginBottom="#dimen/spacing_standard"
android:background="#drawable/button_orange_background"/>
</LinearLayout>
</LinearLayout>
Maybe the default numStars value has changed.
When I set it in the xml file, it works fine.
<RatingBar
...
numStars="5" />
It could be a layout issue too, if wrap_content doesn't have enough space to display 5 stars. Maybe you have qualifiers for Api 23 ? If not and it works fine for <23, do not mind about it.
You can use custom style as below and use that style in your layout file:
<style name="CustomRatingBar" parent="#android:style/Widget.RatingBar">
<item name="android:progressDrawable">#drawable/rating_bar_star_style</item>
<item name="android:minHeight">#dimen/button_height</item>
<item name="android:maxHeight">#dimen/button_height</item>
<item name="android:numStars">#integer/rating_bar_number_of_stars</item>
<item name="android:stepSize">#integer/rating_bar_step</item>
</style>
And use this in your layout as below:
<RatingBar
android:id="#+id/rate_app_rating_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/rate_app_spacing_standard"
style="#style/CustomRatingBar"
android:layout_gravity="center"/>
I think there is some problem with the theme you are using. Please try AppTheme instead of any other and the above code might work for you.

Categories

Resources