How to remove the spinner border? - android

I want to remove the black border from these spinners
Here is a screenshot
PS: If I have missed to provide some vital information, please say so and I will enter here whatever needed.

try this:
<style name="AppTheme" parent="#android:style/Theme.Holo">
<item name="android:dropDownListViewStyle">#style/MySpinnerStyle</item>
</style>
<style name="MySpinnerStyle" parent="android:style/Widget.ListView.DropDown">
<item name="android:divider">#FFEEEEEE</item>
<item name="android:dividerHeight">1dp</item>
</style>

Related

Android preference fragment taking space for icon in list preference fragment

As you can see in the image, it is taking some additional space in left . Later I have found that this space is assigned for icon. How can I remove this space?
I have tried preference.setIcon(null);
Also I have tried the solution given here . But no luck .
I am using compile 'com.android.support:preference-v7:25.1.1'
Edit
Here is my style.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="preferenceTheme">#style/PreferenceThemeOverlayCustom</item>
</style>
<style name="PreferenceThemeOverlayCustom" parent="PreferenceThemeOverlay">
<item name="preferenceFragmentListStyle">#style/PreferenceFragmentListCustom</item>
</style>
<style name="PreferenceFragmentListCustom" parent="PreferenceFragmentList">
<item name="android:paddingEnd">0dp</item>
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
<item name="paddingStart">0dp</item>
</style>
Constructing the new preference like this:
new Preference(getPreferenceScreen().getContext());
should solve the issue.
As mentioned by guillaume-tgl the explanation can be found here.
Edit:
Using the new support library (28.0.0) you should also call:
preference.setIconSpaceReserved(false);
I think its due to the PreferenceThemeOverlay that you are using for that activity.
Your selected style taking default padding from left or right.
use this code
<style name="" parent="PreferenceThemeOverlay">
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
</style>
Just add app:iconSpaceReserved="false" line to your XML file and now there won't be any space from start.

What style would I need for an AlertDialog to bold?

I have an AlertDialog with buttons which I'd like to set to bold. I find the default style to be very thin:
but when I set the style as such:
<style name="DialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:textColorPrimary">#color/gray_dark</item>
<item name="colorAccent">#color/blue</item>
<item name="android:buttonStyle">#style/buttonStyle</item>
</style>
<style name="buttonStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:textStyle">bold</item>
</style>
I find the result to be, erhm, much bolder than I'd like:
I was aiming for something like this:
The screenshot is from WhatsApp. Are they using a different font or is it something I can replicate just by styling my XML file?
Based on the answer here, it seems that the correct style for what I want to achieve is adding these lines to the button style:
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textStyle">normal</item>
Now I have the wanted "not so bold" look!

Set text size of menu items in popup menu

I have created options using customized popup menu.
Now, I want to set the text size of menu items. I am getting default text size this time.
How can I achieve this? I don't want to use popup window. Is it possible to achive this using popup menu only?
I had the same problem. You can change the text size and color by adding this code to styles.xml and use it in manifest file. For me it worked.
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:popupMenuStyle">#style/PopupMenu</item>
<item name="android:textAppearanceLargePopupMenu"> #style/myPopupMenuTextAppearanceLarge</item>
<item name="android:textAppearanceSmallPopupMenu"> #style/myPopupMenuTextAppearanceSmall</item>
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="PopupMenu" parent="#android:style/Widget.PopupMenu">
<item name="android:popupBackground">#android:color/white</item>
<item name="android:textColor">#FF01F0</item>
<item name="android:textSize">12sp</item>
</style>
<style name="myPopupMenuTextAppearanceSmall" parent="#android:style/TextAppearance.DeviceDefault.Widget.PopupMenu.Small">
<item name="android:textColor">#545656</item>
<item name="android:textSize">15sp</item>
</style>
<style name="myPopupMenuTextAppearanceLarge" parent="#android:style/TextAppearance.DeviceDefault.Widget.PopupMenu.Large">
<item name="android:textColor">#545656</item>
<item name="android:textSize">25sp</item>
</style>
You can use something like the below in the manifest file
<activity
android:name=".ActivityName"
android:theme="#style/styleName"/>

Android Spinner style top divider

I'm trying to change the style for the Spinner's top divider, but without success.
I can only get that to work:
http://s18.postimg.org/qbg7920mh/spinner.png
Is is possible? What item should I modify?
<style name="AppTheme" parent="AppBaseTheme">
<!--item name="android:spinnerItemStyle">#style/SpinnerItem</item-->
<!--item name="android:spinnerDropDownItemStyle">#style/SpinnerDropDownItem</item-->
<!--item name="android:dropDownItemStyle">#style/TestSpinnerItemStyle</item-->
<item name="android:dropDownListViewStyle">#style/TestSpinnerStyle</item>
</style>
<style name="TestSpinnerItemStyle" parent="android:style/Widget.ListView.DropDown">
<item name="android:divider">#00b54a</item>
<item name="android:dividerHeight">5dp</item>
</style>
By looking at your code, there must be an obvious error!
Rename TestSpinnerItemStyle to TestSpinnerStyle in second part like:
<style name="TestSpinnerStyle" parent="android:style/Widget.ListView.DropDown">
...
</style>

How to change the default divider color for all ListViews

I am trying to apply default styling for all the listViews from style.xml
Please note at some places I am using nested listViews.
In style.xml
<style name="Theme.MyTheme" parent="Theme.Sherlock.Light.ForceOverflow">
<item name="android:windowContentOverlay">#null</item>
<item name="android:listViewStyle">#style/awesomeListViewStyle</item>
</style>
<style name="awesomeListViewStyle" parent="#android:style/Widget.ListView">
<item name="android:fadingEdge">none</item>
<item name="android:background">#color/orange</item>
<item name="android:divider">#EEEEEE</item>
</style>
This has no effect. In the Manifest Theme.MyTheme as my default theme.
Please advice :)
As mentioned in another answer as Bhavin and Mark pointed out, in your style you should also add
<item name="android:dividerHeight">1px</item>

Categories

Resources