I've got a physical device ready for debugging.
I want to track down the name of the curent activity using the Live Layout Inspector.
Seems like there's no such feature, but is there any roundabout way to do this?
Well, If you are using Android Studio Dolphin | 2021.3.1 or newer, there is no such straight way with layout inspector like the former version. However, you can find the related layout xxx.xml name,which could also help.
Touch any view, find Declared Attributes at the right panel,then shows the layout name, with which will find activty easily.
And also check this: Is there any way to track what fragment/s are visible right now?
Try the Profiler way.
Related
Is there a quick and easy way to see how my application will look on different screen sizes and shapes? Currently, I'm going into the AVD manager, editing my device definition, and then launching a fresh emulator. It takes maybe ten minutes for each one.
They layout is defined entirely from resource files. I don't actually need to execute the app. Is there a faster way to do this?
Edit: I should add: there are some custom widgets in the app.
While looking at a layout open the "Design" tab or open the "Preview" tab on the side. On the top of the window you will see a list where you can change the layout and orientation.
May not solve your entire issue, but it's a good to know.
If you want to have a preview of a static page (not rendered at runtime, like recyclerview), you could use android studio to do that.
I am beginner in android app development, I would like to know that how can i get insights of something that has been implemented, Which layout is used, Which view is it, I try to make some attractive UI and i end-up with some ugly UI, I would like to know how they make UI like this
Which layout they use, Which view they use, I Want to know this insights so that i can learn about them and implement the same in my app.
You can do it this by using Dump View Hierarchy for UI Automator option in Eclipse for that
Go to DDMS and devicesand select the device
and then it's generate your device screen shot .uix as below
Move your Cursor in uix and you'll see the all View Hierarchy Structure in right side upper corner area.
Here you'll get idea about the Layout View only.
#Pushpendra you will never get exactly what you want, you can get some ideas by seeing some existing application and then google it or check some open source projects on github to get starting idea.
You have to use your own creativity.
Here is a basic example to help you start.
Use this library
cardslib
which will help you to built card style layout as some of your shared images UI is designed the same way.
Sample app demo
for above library.
I hope it helps you.
If you want just to how the view is draw, you can go in the "Developer Options" settings and enable the "Show layout bounds" item.
If you want a more in-depth view of the layout, on the SDK you have the "Hierarchy View" that can be accessed from command line or on Eclipse/Android Studio. Inside Hierarchy View, go to the screen you want to know in the phone, select the screen in Hierarchy View and after a while the entire layout tree is shown and you can explore the items in it, so you can have an idea about the layout.
I've recently switched from eclipse to IntelliJ IDEA for Android development. I'm not missing any features, beside the rather helpful designer preview in eclipse. I populate certain views in my activities at runtime, there are no texts defined in the corresponding XML files. In eclipse, it looks like this:
It fills the empty views with placeholder text which is nice to get a rough impression of the layout without having to start the app. But in IDEA, the designer looks like this:
The views are empty, and it's difficult to even see them without selecting them in the Component Tree. I haven't found anything in the options, is this missing from IDEA or did I miss an option?
It's not possible right now, but it would be nice to have, I've created a new feature request, please vote.
Working with Android for the first time, I've blocked out a layout using the relative layout and laid down some buttons and text widgets how I like them. However when I go back to rename the IDs the layout goes all crazy moving elements around and in general destroying the hours of work I spent laying them out.
Does anyone know how I can rename the widgets without Android destroying the positioning for widgets in the Relative Layout? Is this some "feature" of Android? I can't imagine why it would be hard for the UI builder to handle simple renaming of a widget ID without destroying the positioning information.. Do I have to use an external text editor and modify the XML files directly? Ughh I hope not.. I'm using Eclipse IDE.
You can use find and then replace all to change the names every place that they appear. Shouldn't take anywhere near an hour if you're dealing with a small layout.
In general the graphical UI creator that is currently included with the Android SDK is not so great for creating anything but very simple layouts. In my experiences (which were a long time ago, it may have gotten better since) it was terrible with RelativeLayouts.
If you have not modified your xml directly then it is time that you jump in and start learning to do it that way. You'll find that you have a much greater level of control over your layout, and once you get the basics figured out you'll probably be able to create quicker using raw xml then with the graphical tool anyway. I do wish that there were a nice GUI creator for android out there, the best one that I've ever come across is Droid Draw which I found to be better than the one included with the SDK, but still not as good as I was hoping.
To modify the xml directly you don't need any additional text editors, you do it inside eclipse. Open up your layout file and at the bottom click on the tab that says "Source" when you want to switch back to graphical (good to see the changes that you make to the xml graphically) just click back to the tab that says "Design"
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.