An edittext looks different in a 2.2 emulator than it does in a 4.2 version. I want to make my edittext look like it does in the holo light version on a 4.2 emulator.
I have no idea how to do this, do I need to write my own custom style? Thanks in advance
Are you sure that you want to do this? Users of 2.2 devices may not recognize an EditText with holo styling. Remember that there are very few people who have both a 2.x and a 4.x device. Usually, you want a look and feel that will be natural for the user.
That being said, if you are sure that you want to do this, you are welcome to try to get HoloEverywhere working.
I found this web:
Android Holo Colors
check out these links :
1. How to create ICS holo style edit text for older versions?
2. How to create EditText with rounded corners?
3. Styling EditText view with shape drawable to look similar to new holographic theme for Android < 3.0
Is it possible to make an EditText in android 2.x that looks like an EditText from Android 4?
Check the above answer to the Question,
Or You can use the following method (referred from the above question):
add the below code to res\values\styles.xml
<style name="HoloEditText">
<item name="android:background">#drawable/edit_text_holo_light</item>
</style>
After that from YOURPATH\android-sdk\platforms\android-16\data\res\ just copy the edit_text_holo_light.xml and all referenced drawables to the corresponding directories in your project.
And then simply apply the style to your EditText:
<EditText
android:id="#+id/editText"
style="#style/HoloEditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
Related
I'm trying to set the purple underline and cursor colors in an EditText to match green buttons in a dialog (see pic attached). I need to set the colors within the code, as different screens have different color schemes, all set within the code. The colorControlActivated was not introduced until Lollipop and is not available in KitKat, which we have to support.
I look through the question on Stack Overflow Set EditText cursor color, Tried using AppCompatEditText and learned about colorControlActivated property in this article: TextInputLayout proper Theming. I've not found anything that allows me to change the colors in and EditText on KitKat.
Thanks for you help.
Try this solution :
Instead of using EditTextView, change it to "android.support.v7.widget.AppCompatEditText" and then do something like this :
<android.support.v7.widget.AppCompatEditText
app:backgroundTint="#color/red" />
Make sure you are setting app:backgroundTint instead of android:backgroundTint
<TextView ... android:typeface = "monospace" />
This doesn't show any change in the IDE editor or in my phone.
I cant use all the default fonts, It doesn't work.
All the other attributes are working except typeface.
I reinstalled android studio but it didn't solve the problem.
Please let me what should I do.
If you mean that you want to change your font, go to your XML file add statement
android:fontFamily ="sans-serif"
In my android project, I am getting the error "Cannot find symbol for Theme.AppCompat" while using it in styles.xml file:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
I have included the app compat dependency in my gradle file:
'compile 'com.android.support:appcompat-v7:23.3.0'
I tried finding the solution all over internet but nothing helps. Can someone help me with this..
Just wanted to let you know that you're not alone. Everything was working fine in the app I was developing, testing heavily on a marshmallow nexus 5 and a lollipop samsung tablet. I must have let something automatically update, because now I'm having problems with appcompat.
Here's an example of what's going wrong:
in a layout XML I have an edit text with style specified:
style="#style/Widget.AppCompat.EditText"
This will cause 'Error inflating class EditText'
if I create a style for the edit text in v21 styles with a parent of 'Widget.AppCompat.EditText' and specify the background (my color, or drawable, or ?android:attr/editTextStyle) it will work - though all of these options lose the edittext underline style.
If I specify background of ?attr/editTextStyle it will fail to inflate, which I assume is the default, it will fail to inflate. Likewise, if I leave any style tag off of the edit text, it will also fail to inflate.
Glad I'm not alone, but I wish this wasn't a thing...
The attribute tabsBackgroundColor in tagGroup tag not working on android
<TabGroup tabsBackgroundColor="#a466a3">
and backgroundColor not working too , although it is written in the documentation
http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TabGroup
You'll need to modify your theme file / create a custom android theme to set the appearance of of your tabs.
http://docs.appcelerator.com/platform/latest/#!/guide/Android_Themes
If you read that you'll see how to add and setup a custom theme to override the base theme that Titanium gives you.
The XML property you'll want to modify for the background colour is actionBarTabStyle
A helpful but old tool that you can use to auto generate this is https://jgilfelt.github.io/android-actionbarstylegenerator/
With 4.1 jellybean, Robot has started to make appearances throughout the system UI. I would like to use the new attribute 'fontFamily' within Eclipse as documented in the Font Families section of this page:
http://developer.android.com/about/versions/android-4.1.html#UI
The goal would be to use Roboto on all devices that support it (without including it in /assets) and have the typeface degrade gracefully to Droid sans on all non 4.0+ devices. Again, don't want to have to include in my .apk, understand that is easy enough to do.
Would love to see sample code or feedback on successful use of fontFamily with API 16.
Its pretty easy, since older versions of Android will ignore xml attributes they don't understand you can just set it on your text views or your app's styles. Or you could set it manually in code but thats more work :p
And if you're using the regular version of Roboto you don't need to do anything special, its the default in 4.0+ (you might need a holo based theme, I can't remember), and Roboto bold and italic are accessible using TextView's TextStyle attribute.
In xml
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
/>
Or in code
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN){
textView.setTypeface(Typeface.create("sans-serif-light", Typeface.NORMAL));
}