Preview full XML from ScrollView without the telephone frame in Android Studio - android

I am wondering how can i preview my XML, without the telephone frame and see all the activity/fragment.
Why i want to do that? Because i'm using lots of ScrollViews and sometimes is impossible to see what's after the bottom of the telephone.
Is there any way to accomplish that?

First, You can set scrollview on top layout of xml and click on design tab.
Now see the first button of the above toolbar, press it and u can see full view of all layouts in xml.
For Example see below image:

In the toolbar above the preview pane, click on the settings icon (cogwheel) and deselect "Include Device Frame (if available)"

Related

how to show design layout right side my xml code in android stdio?

i try to showing desing layout side my code. exmple
I have
my android stdio screen
I want to another screen for example
Do you mean Layout Preview pane?
When you have opened your xml layout go to View -> Tool Window -> Preview
Just click the Preview under Gradle in right side of Android Studio.
You can live preview the code but can not view the interaction like press a Button or any other interaction effect. To view this interaction effect you must run your app in emulator.
See the pic for clearly understand.
If your android studio is version up to 4, then just click the split button.
Then you can see the preview of the code and design layout.
See the pic for clearly understand.

Android Studio can't extract layout

I am a complete beginner and following a guide. it asked me to click anywhere on my vertical layout and refractor -> refract this -> extract layout but as you can see in the screenshot all my options are greyed out
and the only option that I get in refactor this is "remove unused resources"
https://www.dropbox.com/s/vkeh7m1gs5zmeek/Screenshot%202017-06-23%2018.55.37.png?dl=0
https://www.dropbox.com/s/71v1b3nc2ysqk0t/Screenshot%202017-06-23%2022.46.12.png?dl=0
Maybe you are clicking on the LinearLayout Element on the Left side, Guide says to click anywhere inside vertical layout.
Try right clicking on the vertical layout in Design View.
In the preview screen, click on the layout you want to extract.
Then choose Refactor and Extract style.
You can save the layout in camelCase or in lowercase.
Note: You should not start layout names with captial letters.
Anywhere in the vertical layout means any elements inside the design window. But not inside the Component Tree. That means click anywhere inside the red marked area.

Buttons not visible on the application. What's wrong?

I created an empty activity for 'My Testing App' and it looks like the following in the preview section:
But when I generated a build apk and used the same in my cell phone the result was like the following:
I can only view the exit button on the very top left but the two other buttons, that should be above it are missing.
I tried to rearrange the icons on the screen as well. I made them to go to the bottom, to the right most, but I see no change when the apk is reinstalled.
How do I make them visible on the hardware?
Here is the snap of the code for this activity:
To quickly add constraints to your layout just click on the Infer Constraints button in the Layout Editor toolbar. Learn more about the feature here: https://developer.android.com/training/constraint-layout/index.html#use-autoconnect-and-infer-constraints
Right Click on you Layout and select "Convert View" Option.
then select "LinearLayout" Option.
it will show all three buttons in the output.
You have to learn about ConstrainLayout in Android
View in ConstrainLayout is not only drag and drop. You should link the constrain line in each view to reference with somewhere on the screen.
Any XML attributes prefixed with tools are removed when the app is compiled and are only rendered by Android Studio layout editor.
You need to properly set constraints in your ConstraintLayout, not use absolute positioning.
Or you may instead use RelativeLayout, LinearLayout, etc.
https://developer.android.com/training/constraint-layout/index.html
Start by reading this. Most of what you need is answered here. The problem is that your views are not properly constrained (basically they aren't linked to anything so when you run your app it doesn't know where to place them and just defaults to the upper left).

Tips at start-up or update

I have an update for my app that includes ActionBarSherlock with a sliding menu. I have put my navigation entirely in to the sliding menu, leaving my main_activity pretty bare. I am worried the user won't know about the menu. So I want to add a prompt at start-up that will highlight the new feature. Like this:
I am not even sure what this is called, so I don't know how to research it. Any help or suggestions will be rewarded. Thanks!
You could just use overlay layout (Frame layout with multiple inner layouts will fit perfectly. Please note Frame Layout Z axis is by the lower the layout is in the xml, so the guide should be the last in the XML). Make that layout's background mostly transparent and add buttons and design to fit your needs. When you don't want to show the layout just set visibility to gone. And when you need it set to visible.

Eclipse IDE - Android Graphical Layout and XML Layout Side by Side

Is it possible to have the Android Graphical Layout next to the Android XML layout so I can modify both simultaneously? It would be much better to change the XML and instantly see the effects, as opposed to clicking the tab to change it all the time.
Yes, although I just tried it and it has a bit of lag after you change something in the Graphical Layout editor.
Open your layout file, such as "activity_foo.xml".
Choose the menu item "Window > New Editor". This will give you another editor for the same layout. In this example, you'll see two tabs that both have "activity_foo.xml".
Mouse press on the second tab and then drag it to the right and downwards, until you see the outlines of two rectangles representing editor views side by side, then let go of the mouse button.
You now have the editors side by side. Place one into Graphical Layout mode and the other into XML mode by choosing the respective tabs.
Note that it seems like the Graphical Layout will consistently update the XML. However, changes in the XML don't seem to affect the Graphical Layout until you save and then click in the Graphical Editor again.
I managed to make the code instantly update the graphical layout and to have both of them shown at the same time.
First, I followed the steps given by louielouie on his answer to have both graphical layout and XML code shown at the same time but this wasn't enough.
Then, I clicked on the code of the XML file and after that I clicked on the graphical layout. At this point, I was able to make changes on the XML file and they were instantly shown in the graphical layout.
There is a little bit better possibility to do that then with new editor like louielouie wroted..
1) Open your layout from project explorer and show it in graphical layout.
2) Get project explorer, right click on your layout
3) Select OPEN WITH -> XML EDITOR
4) At bottom you can switch between Source and Design layout.
5) Catch the 'header' and put it on the side of your graphical layout.
In short word just right click your layout -> open with -> xml editor.

Categories

Resources