XML is showing OLD API UI ANDroid - 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):

Related

Espresso testing on Android API 28 emulator click issue

This is only on Android devices with api level 28.
trying to match a text after clicking the spinner fails.
Two approaches, one looking for a window that is not the activity, the second is looking for popup menu:
...
// Look for text "Green" in the menu
onView(withId(getFieldId(COLOR_ID))).perform(click());
onView(withText("Green"))
.inRoot(withDecorView(not(is(rule.getActivity().getWindow().getDecorView())))) // Look for popup menu
.perform(click());
// Second spinner, Look for the text "Medium"
onView(withId(getFieldId(SIZE_ID))).perform(click());
onView(withText("Medium")).inRoot(RootMatchers.isPlatformPopup()).perform(click());
...
Both are working fine with devices API <=27
Any idea why this is not working on 28? Thank you.
Problem solved by updating build tools version to 28.0.2 (was 28.0.1) and replaced all android support libraries to use androidx

Android Studio 2.1.2 Rendering problems. VectorDrawable_Delegate.nDraw

When attempting to view a preview of your app you may encounter the following...
Rendering Problems Exception
raised during rendering:
android.graphics.drawable.VectorDrawable_Delegate.nDraw(JJJLandroid/graphics/Rect;ZZ)I
Issue is resolved by de-selecting the API 23 preview as shown below, select the non Preview option.
I think I am a bit late to answer, but the solutions provided above did not work for me.
The rendering error sure does go away, but the rendering displayed finally after selecting API 23 is incomplete or wrong.
In my case, the action bar custom theme color and everything vanished.
So, for everyone out there who has a custom theme in their app, here's a solution -
Check if in the XML preview pane, the rendering theme is selected as the one which is associated with your app in the manifest file.
Select your custom theme in the preview pane, the error will be gone and you will also be able to preview with the latest API (API 24)

Same style on all API using AppCompat

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.

Android Studio won't display Drawer Layout

Honestly it is giving me this error for almost anything I try to do that isn't adding simple buttons or text. I have tried everything I could think of and find on the interwebs. My API is set to the right API (8). I have updated everything I could in SDK Manager. This is the error:
Oh I cut off the beginning of the error. It says:
Failed to configure parser for:
(Cannot post images without 10 rep)
Thank you
The problem is that you're probably using a lower minSdkVersion.
You can try set the minSdkVersion to 17 or higher(in the build.gradle)
minSdkVersion 17
targetSdkVersion 21
I think "Android Studio won't display Drawer Layout" means the Palette didn't display your DrawerLayout instantly. Actually, it's a normal behavior. After all, the Palette only displays static monolayer views while the DrawerLayout is a complicated ViewGroup and it has multilayers: the drawer and the content. Meanwhile, DrawerLayout is a dynamic View whose effects only could be seen on a device or a simulator. So, feel free to run your Activity which loads this layout, and you will see the effect of your layout which contains your DrawerLayout.

Android layout render without compiling

I'm new to developing with Android, and the biggest new thing is the way the UI is rendered (relative to other views instead of absolute locations and sizes). As a result, I've been experimenting a lot with layouts, and find myself changing 1 view or even just 1 property of a view, then having to recompile and launch it back into the emulator to see the result. Is there a tool that quickly (or at least quicker) shows what a UI looks like give a layout xml file?
You can look at http://www.droiddraw.org/ but it is not perfect.
You can use Eclipse with Android Development Tools, when opening a layout file you get a preview of what looks like. Besides, ADT provides some nice features for developing and debugging in the Android platform.
When you're in the XML view, simply click the "Layout" tab on the bottom, and you'll be taken to a visual representation of your layout:
Like so:
There are some limitations for sure (e.g. text shadowing, for one, will not be depicted in this view), but it's a good way to get a general idea of how your layout is working.
Versions 2.x and higher of Android Studio render the XML in real-time in the Preview pane of the IDE and it even juxtaposes the XML and outline views side by side.

Categories

Resources