Same style on all API using AppCompat - android

I'm using com.android.support:appcompat-v7:22.2.0 to make Lolipop material design on pre-Lolipop devices. The problem is that widgets (example EditText) are displaying different views with different parameters on different API.
Question is how to make it all looks the same on all API 15 and above?
Example here (different bottom line, margin between text and line etc.):

I think that I found solution.
AppCompat generates proper look during inflating layout.
If API < 20 it generates look like newest API (ex. 22).
If API >= 21 it generates look depending on API.
Don't look at preview in XML (my image is from previews). Open emulator and check by yourself how it will looks on device.
Hope it helps someone in future.

Related

TimePickerDialog custom theme

I'm developping an Android app and right now I'm having an issue with a part of my UI: a TimePickerDialog. I'd like the top part of the Dialog to be orange instead of the classic
I know that I could create a custome theme, but my boss want it developp in 4.0 (API 15) so that it covers almost every device.. I don't know how to set a color with using settings covered by API 21 and up..
TimePickerDialog appearance is very different in the API levels you are testing on. The biggest redesign was probably made in Lollipop (API 21), where the default dialog has a totally different (circular) look:
If you are testing on API21+, you are probably seeing this one. The background color AFAIK can be changed by tweaking the android:color* attributes in your theme. I'm not sure which one (could be android:colorAccent, android:colorPrimary...), but it is easy to determine.
However, since you are going to deploy down to API 15, and default time picker there is quite different, I would recommend using an external library to give each user the same look and feel of Lollipop.
The most used is probably this one, and allows you to style the dialog in terms of colors and much more.
API>=21:You can define <item name="colorPrimary">xxxx</item> in your style of theme
API<21:Use libary for example material libary

How to create a background selector that has Kitkat style for pre-Lollipop, and native one for Lollipop and above?

This question is short.
How do I set a background for buttons and such, that will have the native look&feel of Lollipop (ripple etc...) for Lollipop and above, and Kitkat style for Kitkat and below?
I ask this to make this library look better:
https://github.com/AndroidDeveloperLB/MaterialPreferenceLibrary
I think this is possible by declaring the different 'styles' in the corresponding 'values' folder. I think the following link can help:
http://developer.android.com/training/material/compatibility.html#Theme

XML is showing OLD API UI ANDroid

I am developing an app and using spinners(Using eclipse). I am using Fragments and also using support-v4 library. I have set MinSdkVersion to 8 for backword compativility.
The problem is, in XML, when I drag and drop spinners, it is showing me the old UI for spinner which was there in API 8 or 9 and designing UI is becoming almost impossible.
(However in my Phone, it is showing the latest UI for Spinner, but I can't design it well in XML - eclipse.)
Also attaching the URL of snapshot (as I don't have enough reputation to post and image) of the XML view within the eclipse.
Link to Image : http://tinyurl.com/ErrorInUI
I tried changing MinSdkVersion to 17. It didn't work.
In your XML Graphical editor, you can change the appearance by selecting the rendering style in the API Level dropdown (there's the current API Level number with an arrow, near the little green robot):

How can I make stylish xml layout design when using Scrolling View for xml layout?

I'm using the library called simple-side-drawer
This enables `DrawerLayout' for any version which is supported only at API Level 18 or higher.
I downloaded demo from the page and tried to make stylish layout by customizing right_behind_menu_simple.xml
However, it always returns error and won't show stylish layout even if I copy and pasted example to it.
The error is always related to something about <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
I'd like to make Menu just like this. How can I?
Can anyone download demo and show me what to do with right_behind_menu_simple.xml and its style.xml?
It'll be appreciatable, if you could upload example project.
Thanks!
You should use Navigation Drawer instead of using third party library for api 18 or above, Use official doc for this : Navigation Drawer

ListPopupMenu on pre android 11

I want to know if someone knows a library that contains a back ported implementation for ListPopupMenu that works on pre android 11
I don't but you could use PopupWindow whcich is available since API 1. You can create a list as your contentView. You can use showAsDropDown which could give you the same type of effect
This might be worth checking out. I like to use it for backwards compatibility sometimes for the effect it gives
PopupWindow
showAsDropDown

Categories

Resources