I want a white EditText.
Which theme shall I use?
I can customize the rest of the looks.
I searched for any xml file also, to find which one could I use as the drawable background, but did not find one.
Can anyone suggest any xml or theme?
The EditText now is black.
I want it to be white colored and same design.
I.e.: just a line, not the braces at the end.
I have looked into the drawable folder of the API 22 SDK, but it did not help...
I got only One solution, but it gives the older EditTexts in white colour.
Like this one
In android manifest file apply the theme .
<activity
android:name="your activity name"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:theme="#style/Theme.App.Base"
android:windowSoftInputMode="stateHidden|adjustPan" >
in the values-v14 folder change the style to below
<style name="Theme.App.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorControlNormal">#FFFFFF</item>
<item name="colorControlActivated">#FFFFFF</item>
<item name="colorControlHighlight">#FFFFFF</item>
</style>
Hope it will help you
Related
Below is the screenshot of the latest PayPal SampleApp from github: the default "hint" color fades on the background. Tried to apply a custom theme with a darker textColorHint, but it doesn't seem to change anything:
v21/styles.xml
<style name="AppTheme.DarkHint" parent="android:Theme">
<item name="android:textColorHint">#99000000</item>
</style>
app manifest
<activity android:name="io.card.payment.DataEntryActivity"
android:theme="#style/AppTheme.DarkHint"/>
or even
<application
android:theme="#style/AppTheme.DarkHint"
Any other way I could try to fix the issue ?
I am trying to change text color globally in my application, so by the instructions of http://developer.android.com/guide/topics/ui/themes.html I defined two themes in a xml file and set it in the manifest file. But the result was: some text change and major don't, I tried a lot of things, did a lot of research but I wasn't successful in find a way to do this. I observed that the text that changed the color was normally in TextView's that were in first level of the layouts. I am not sure, but I think second level and, so, and the ones that were in listviews didn't change. Can anyone give me a clue? Thanks in advance.
my theme file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Dark" parent="#android:style/Theme.Black.NoTitleBar">
<item name="android:textColor">#color/green</item>
</style>
<style name="Light" parent="#android:style/Theme.Light.NoTitleBar">
<item name="android:textColor">#color/yellow</item>
</style>
</resources>
Manifest file entry:
<application
android:name=".TestApplication"
android:icon="#drawable/test"
android:label="#string/app_name"
android:theme="#style/Dark">
I have an app where I haven't explicitly defined any colors. The app looks different on my phone than it does on a few other phones around my office (the title bar at the top of the app on my phone is blue with white letters and on other phones it's gray with white letters). How do I make them all the same? Is it as simple as just explicitly setting the color in my app?
You need to apply one of available themes to your application. You can do it AndroidManifest.xml, just use android:theme attribute:
android:theme="#android:style/Theme.Holo" if you want dark theme or android:theme="#android:style/Theme.Holo.Light" if you want light theme.
If you use put this app in one of your <activity> tags, only corresponding activity will be styled, if you put it in <application> tag, style will be applied to the whole application.
Of course, you can define your own style in styles.xml:
<style name="AppTheme" parent="android:Theme.Light">
<item name="android:windowBackground">#drawable/bg_window</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
Here's the example of AndroidManifest.xml:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
>
<activity
android:name=".Activity1"
android:theme="#style/AppTheme2"
/>
<activity
android:name=".Activity2"
/>
In this example, AppTheme2 will be applied only to Activity1, while AppTheme will be applied to all other activities.
All the buttons, textviews and other UI elements not designed by you will change their aspect depending on the selected Theme. If you choose the default theme, all the GUI widgets will look different depending on the device manufacturer, the Android version, etc.
You can specify a concrete theme, such as Holo, with the problem that it won't work on Android versions prior to 3.0. You can keep the default theme for the old version, or otherwise you can use this website to generate all the Holo-style GUI elements yourself:
http://android-holo-colors.com/
the title bar at the top of the app on my phone is blue with white
letters and on other phones it's gray with white letters
This is the problem with the customized frameworks of some OEMs. They override the default android styles. I assume that the device with a blue title bar is a Samsung device with TouchWiz on it, right?
I order to have a consistent title bar you'll have to declare your own theme:
<style name="AppTheme" parent="android:Theme.Light">
<item name="android:windowBackground">#drawable/title_bar</item>
<item name="android:windowTitleStyle">#style/WindowTitle</item>
</style>
<style name="WindowTitle">
<item name="android:singleLine">true</item>
<item name="android:textAppearance">#style/TextAppearance.WindowTitle</item>
<item name="android:shadowColor">#BB000000</item>
<item name="android:shadowRadius">2.75</item>
</style>
The original title_bar 9 patch.
This is the answer to your question. However in my opinion you should't use title bars, use the ActionBar instead. You can use ActionBarSherlock for backwards compatibility.
Is it possible to change the colour of background while switching between activities?
I mean the black colour what apear while one of activities disappear and before second appear. Thanks.
Just you need to head over to the activity_home.xml
At the starting lines of code add this background parameter to set the screen black
android:background="#ffffff"
you may change the theme that you are using as follows:
application android:icon="#drawable/icon" android:label="#string/app_name"
android:theme="#android:style/Theme.Light" >
Edit
as mentioned in the documentation:
<application android:theme="#style/CustomTheme">
and then tweak the theme that you like:
<style>
<color name="custom_theme_color">#b0b0ff</color>
<style name="CustomTheme" parent="android:Theme.Light">
<item name="android:windowBackground">#color/custom_theme_color</item>
<item name="android:colorBackground">#color/custom_theme_color</item>
</style>
here is the link to the topic http://developer.android.com/guide/topics/ui/themes.html#ApplyATheme
I want to define a default text color for my android app.
I have a base activity class, that all activities are extended from it and I thought this might be a good place to define the colors.
If not what is a better solution? Maybe styles?
Trouble is this, all is new to me, so feel free to advise me and provide code snippets and explanations as well.
This is what my base class looks like. As you can see it's pretty empty
package com.ccslocal.mobile.quiz.jls;
import android.app.Activity;
import android.os.Bundle;
public class BaseActivity extends Activity {
//set up app preferences here
}
As was mentioned in denis.solonenko's answer, the correct approach would be to modify your theme.
Where you define your theme (in your themes.xml or styles.xml file), you'll want to add something like this:
<style name="AppTheme" parent="#style/Theme.AppCompat.Light">
...
<item name="android:textColor">#FF00FF</item>
...
</style>
Then make sure that the theme is applied to your Activity or Application in the manifest:
<application
...
android:theme="#style/AppTheme"
....
>
You can also define:
textColor - The default text color of any given view
textColorPrimary - The default text color for enabled buttons and Large Textviews
textColorSecondary - The default text color for Medium and Small Textviews
textColorTertiary - ?
(Source TextColor vs TextColorPrimary vs TextColorSecondary)
Keep in mind that many other things may override these predefined colors, such as applied styles or definitions in different resource folders.
See here for a full list of theme items: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/themes.xml
Create a custom theme for your app. Take look at the official guide.
Yes you are right you can make that using style. Or you can use TextView.getTextColors().getDefaultColor() for set default text color. Actually I never used this but I think it may be help you.
For style
<style name="TextColor">
<item name="android:textColor">#00FF00</item>
</style>
Then in layout file
<TextView style="#style/TextColor" />
Set your default color in your res/values/colors.xml like this
<color name="defaultTextColor">#ffffff</color>
So this color to all your texts
android:textColor="#color/defaultTextColor"
or
textView.setTextColor(R.color.defaultTextColor);
Create style for TextView:
<style name="TextViewTheme">
<item name="android:textColor">#android:color/white</item>
</style>
Apply it in style for App:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:textViewStyle">#style/TextViewTheme</item>
</style>
And remember to change style in AndroidManifest.xml:
<application
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
...
</application>
#android:color/white
yes you can change default color of react native app only add this line in styles.xml file of android src