How do I enable the rulers on Layout Editor? - android

I've seen some Layout Editors in Android Studio with a ruler on top and on the side for the Preview window and I'm trying to figure it out how to enable, any ideas? I'm using Android Studio 3.0.1 and I can't see them.

Seems like the ruler has been removed from the Preview tab of the Layout Inspector since Android Studio 3.0. It's 2020 now and Android Studio 4.0 has a new Layout Validation tool to preview the layout on different devices and display configurations. Not really the same but at least the Layout Inspector seems much more reliable than those days.
More details at: https://developer.android.com/studio/debug/layout-inspector#layout-validation

The Guidelines are the rulers. You move them around to get the measurements you need. Expressed in percentages or units.

Related

App interface different in Android Studio and Emulator

An Android App development beginner here. I created a simple app which converts KMs to Miles and vice versa. Issue seems to be with the interface. The interface for activity_main.xml is as below:
Interface on Android Studio compiler
But once I emulate it on an Nexus 6 API 29 emulator, it looks weird and doesn't work properly. Tried it on a Nexus 5 emulator as well, same issue. Here's a screenshot:
Nexus 6 API 29 Emulator
Moreover, when I tried installing the apk file on my Samsung Note 8, it doesn't install, even after changing the settings and allowing unknown apps to be installed. Please help.
Judging from first screenshot (red alert icons in "Component Tree" window) the issue is the fact that You did't constrained Your Views.
When using ConstraintLayout You can't just 'place' views in editor, they need to be constrained to something in order to be displayed in desired place.
For example: Your button with text "Convert miles to kms" should be constrained as follows:
left to parent left
right to parent right
top to EditText above it or to TextView "KMs".
But other views need to also be constrained to get desired behavior.
You can read about ConstraintLayout and how to use it in this tutorial from official documentation: https://developer.android.com/training/constraint-layout

Text Size in Android Studio and Actual Device

I am using the visual editor in Android Studio. In there, the text is really big, like how I want it to be. But when I build it on a physical device it is default size.
Thanks in advance!
simply create many layout that support pixels make all your layout handle your show way
read this to understand the idea
https://developer.android.com/training/multiscreen/screensizes
and do this in your code then check the devices
https://stackoverflow.com/a/8256573/6998825
there's also something else you may have not noticed yet
in android studio Preview Layout you can choose your the preview device as your actual device or same as it.
this way the preview design will be same as your device. but for other devices you should have above answers in mind.

No device screen in Android Studio

I'm having problems in Android Studio. I can't see device screen in activity_main.xml and fragment_main.xml, but as well I see it in content_main.xml. Also, I can't add any elements to screen.
In the preview pane of right side try changing your API level to some lower or higher API it will most probably solve your issue.

How to zoom out Android designer view in Intellij Idea12?

I am trying new Intellij Idea 12 for Android development.
I've sucessfully imported all my eclipse projects but I still can't figure out how to zoom out the designer view?
I have troubles with XHDPI layouts on my laptop resolution.
I couldn't configure that too, but I could find a better solution, at least for me:
There is a Preview tab on the right side of the IDE, when you are in XML text mode.
After clicking you can watch your layout changing dynamically as soon as you make edits, and also you can zoom in/out from there.
Hopefully, they will fix this in upcoming updates.
This article helped me.
Android UI Designer in IntelliJ IDEA doesn't have any zoom options, it always displays in 1:1 scale for the chosen device resolution. Zoom feature is available only for the Preview (when you are editing layout XML code manually and Preview is displayed in a tool window).
I didn't find this feature requested, so you are welcome to submit a new ticket.

Android: Styles, Includes don't take impact on preview?

Is it normal, that styles and includes don't have any effect in preview in Eclipse? The more I get into Layout building the less I can use the preview. Even in the newest SDK Version it's so poorly made.
Yes, this has been my experience with the Eclipse layout preview.
The layout preview of Eclipse is not suitable for a real representation of the final layout.
To get a real representation use either an emulator or a real device and the HierarchyViewer if you want to debug your layout.
There exists DriodDraw which is a web-based visual Android layout composition tool written in Java. It is however limited in its functionality and maybe not really what you were looking for.

Categories

Resources