Is there a way to make the buttons on an Android notification lowercase (instead of all capitals), without building a custom notification 'from scratch'?
In this example, the "REPLY" and "ARCHIVE", would become "Reply" and "Archive":
https://i.stack.imgur.com/TW17I.png
Edit
So I don't really know what I am doing here. But one thing that I tried, was to modify various style templates (50+, basically every single one I thought might be involved), to look like this
<style name="TextAppearance.Compat.Notification" parent="#android:style/TextAppearance.StatusBar.EventContent">
<item name="android:textAllCaps">false</item>
</style>
This did not work. However, because I do not know what I am doing exactly, I may have made a mistake. Any advice on this approach is also appreciated.
Lower case is now supported from Android 11, just provide the text in the desired form to NotificationCompat.Action() and the rest will be done by android.
Related
I want to have 2 different colored buttons for my app. I am currently using this in styles.xml but it applies this theme for the whole app:
<item name="android:colorButtonNormal">#color/primaryColor</item>
I tried using this in the button but it makes no difference,
android:backgroundTint="#color/accentColor"
Please help! I would appreciate clear answers as I cannot find the answer anywhere. Thanks!!
I have this design to achieve:
but the result I got is this:
As you can see I am asked to create the submit button much larger that it actually is, I've tried setting it as an image with no luck, also I've tried entering it as normal text and manipulate the theme but that didn't work either, I'm using the latest and greatest API 21 .. Lollipop.
here's the code to the item in my menu:
<item
android1:title="submit"
android1:id="#+id/userLoginSubmitActionBar"
app:showAsAction="always|withText"/>
Have you tried using android:actionLayout attribute of the <item> tag? It will let you set a custom layout to be displayed. You could use a TextView and set the text size appropriately :)
As for the arrows, if I am not wrong, < means up navigation while <- means presence of a navigation drawer, right?
This is really a hack I suppose but what the hell, here's my solution to my own contribution,
I've set
<item name="android:actionMenuTextAppearance">
to my own custom theme parenting from
<style name="myStyle" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
and the damn thing worked like magic ! haha... thank u guys, really, no need for the drum rolls in the background :D
I'm currently developing an app which should be totally customizable by endusers. Imagine the application has many activities with some TextViews, Buttons, etc.
So the client can create a XML file like this one:
<style >
<h1>25dp</h1>
<h2>30dp<h2>
<actionbar>#cecece</actionbar>
</style>
As you can imagine, for example, there are several TextViews which are always "titles" so they should always take this h1 value.
I know I can parse this XML file and for each textview, apply this style manually, but this is not a good way of achieving this because if I had 3000 textViews, I should manually edit them all.
What I want is to "edit" the actual Style programmatically.
Any tip?
You can't access a resource file in the created APK as they are compiled into it. So your idea to "customizable" styles works only in the following scenario:
your app is a library project
your client uses that library project and create a style which extends/overwrites your own style and compile that into a new APK
You are not clearly telling us if the "enduser" is a user of your app/apk or a customer that can do the above mentioned modifications.
An alternative might be to create your own extensions of TextViews, Buttons etc which can load your style set. You need to create your own style language for that and you need to make sure that the custom views understand and apply them.
A lot of work, if you ask me... I would, in general, suggest to make different themes so that the customer can pick the best suited for them...
Background
On Android, you can set an error indication for any EditText view when you want to show the user that what is typed there (or not typed) is wrong (called "form validations").
There is even a nice library for this (here) , and many post here are available of how to use it.
All worked well for me till I've ran it on a nexus 4 with Android 4.2 .
The problem
Sometimes, it just won't show the icons of the errors. In such a case , only when i give the editText (that has the problem) focus, it shows the bubble, but it's empty and doesn't show the icon of the error.
Also, in all cases, the bubbles are always empty.
Why does it occur, and how can I fix it?
Note: I use actionBarSherlock library so I need to use their themes or a theme that is based on theirs.
EDIT:
here are some screenshots:
android 4.2.2 :
android 2.3.5 :
EDIT:
after i thought that this was solved by itself, i've finally figured out when this bug occurs:
if the focus is on another editText which doesn't have an error, and the error of validation is on another editText , the indicator isn't shown till the editText gets focus.
Problem 1: The problem is the Theme of the application.
Try changing the theme to some darker theme like:
<style name="AppBaseTheme" parent="android:Theme.Black">
and it should solve your problem. I found this similar issue earlier and rectified this by changing the theme.
But I didn't research much but I feel that this is Android issue and the bubble should try to change the text colour according to the theme.
Let me know if it solves your problem, or not.
Problem 2: The other issue you are talking about for not taking focus, you may consider the following link: Text Truncating and Focus Issue.
----------------------------------------Updated Answer---------------------------------------------
Q1) What should I add to the theme configuration in order for it to always work, no matter what theme I use?
According to my findings here are some results:
[Note: Only applicable for devices running 3.0 and up]
If your build target is:
less than 11, then using
parent="android:Theme.Light" --> setError() message doesn't work or shows very faded text colour almost blending with color white
parent="android:Theme" --> setError() message works
greater than 11, then using
parent="android:Theme.Holo.Light" --> setError() message works
parent="android:Theme.Holo" --> setError() message works
Since, your project is supported for devices less than 11 API level and you want to support 4.0 and plus too, your best bet would be to go and integrate HoloEverywhere in your project which will solve your problem and you will be able to use your ActionBarSherlock too, for compatibility, check this SO Post.
Q2) What are the available configurations for the error indication UI ?
Mostly you can customise drawables and icons but I doubt you will be able to configure your text and background(If anyone knows more may point out on this)
I would suggest you to check this SO Post for immediate answers.
And for placing the correct focus, for every validation checks, you may place this code:
EditText.setFocusableInTouchMode(true);
EditText.requestFocus();
EditText.setError("My Error Text");
Let me know for any issues.
There are lots of way to style ListViews to give them elegant look, but all of them involve modyfying the adapter or writing additional code.
With the release of Android 4.0, unfortunetely things have to change. Google polished their Holo theme and gave it new look. All of the developers are now encouraged to use it, in order to make all apps look the same.
And here's the problem. Google rolled out 4.0, but there are still people using older Android versions. We can't just leave our previous custom application themes and use Holo, because it will ruin visual experience for users with older devices. And we can't force 4.0 users just to use Holo, because let's be honest - it's still not perfect.
The goal is to use builtin themes system and prepare some alternatives for Holo, which will look great on all devices. Then we can just switch between Holo and our themes with just setTheme() and no additional problems. Unfortunetely it's not that simple. We are limited to the capabilities of existing theme system and some things are just hard to do. And here comes my question.
Taking everything I've mentioned into consideration, how can we control ListView look? I'm not able to figure out, how to:
create list with rounded corners and make sure the selector background doesn't ruin it when selecting first/last element
create rounded corners not for the list but sections separated by headers, something like here:
The solution should affect ListViews created by PreferenceActivity without any additional lines of code. Everything should be contained in the theme:
<theme name="SampleTheme" parent="android:Theme">
...
</theme>
I kindly ask not to post solutions that do not use styles & themes. They can be easily found in another questions, here on Stack Overflow.
Thanks in advance.
I can see two ways to solve this.
One is simply to use a theme for your listviews specifying the background, which in turn is a 9 patch with rounded corners or an xml shape you specify (with rounded corners as well). This will have the side-effect of the listview row selector appearing 'over' the background you specified, therefore kind of spoiling the effect. It is quite straightforward to implement though.
The second option is to simply always add headers and footers to your listviews, which have backgrounds that are selectors with rounded corners on top (and bottom). You can specify styles for these as well if you really want to.
Sorry for this last comment, but I had to say it. Please don't try to make your app look like an iPhone app :)