Editing multiple elements in Android XML layout via Eclipse - android

I am trying to edit multiple textview's in a xml layout. Before installing Juno, i was selecting multiple elements pressing shift button and all properties were shown on the Properties view, so i can make batch edits. Now all i have on Properties View;
ID,
Text,
Hint,
Text Color,
Text Appereance,
Text Size,
Content
In this particular case i want to change all their gravities from none to right. I guess i did something wrong with the eclipse preferences or missing something else.. need help thx

I just tested it with Eclipse 4.2.1. I opened an xml layout file, selected a bunch of TextViews, then did a right click and clicked "Properties". All attributes appeared in the properties view and I easily batch-edited them.

Related

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.

layout:row missing in Android studio

can anyone help with missing layouts?
I used ImageView , however I can't find field layout:row and also layout:columns in the Text or in the properties. missing layouts
enter image description here
There should be two tabs under the Design window, one labeled "Design" and another labeled "Text". In the text tab, you can edit the raw layout xml, i.e. by moving the ImageView's tag(s) to between the <GridLayout .... /></GridLayout> tags. This approach is, incidentally, applicable to most instances of the Design editor refusing to take your orders.

edit imagebutton picture

I made an app that displays an AlertDialog once I click on an ImageButton in eclipse.
But when I was trying to input a picture onto the ImageButton, I only found a way to do it in the XML graphic layout of eclipse via right clicking on the Button and then on "edit src". Is there a way to put in the picture from written XML itself?
Yes. You can put a picture into the written xml of an Android layout file.
With your xml file open in eclipse, there are two tabs at the bottom of the layout:
Graphical Layout
.xml
Press the ".xml" tab and you can edit the raw xml.
In order to add an image to your ImageButton, do this:
android:background="#drawable/your_image"
There are also other tags that work too, such as android:src, and the differences are described here: What is the difference between src and background of ImageView.
There are also ways to add the image or change the image programmatically in your .java file. This is useful only if you want to change the image dynamically (although, see below for changes of state)
And, this is just the beginning of what you can do...
If you don't want the default frame around the button, you can use other items, such as an ImageView to make your button.
If you want to display various graphical images depending on state such as "pressed", "selected", etc, then you can specify a "selector" file instead of "your_image". There are many examples of how to make "selector" files on this site, and how to implement the other upgrades to your button.
Have fun!

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.

styling tabs using styles.xml

I have a row of 5 tabs at the bottom of my app. The problem is the text is cut off on some of them. I want to be able to have the text in each tab stack on top of each other instead of following along horizontally aswell as move the text into the center of the tab instead of sitting at the bottom.
I have created a styles.xml file and have altered the text size but I am not sure how to add the requirments I stated above to it. Can anyone help?
Thanks
The style resources uses the same XML attributes as an XML file. You altered the text size successfully, so just add the attributes for the other desired styles. If you don't know which attributes to use, just go to your XML file and type android: and your IDE should pop up a list of all Android XML attributes. If not, go to the View page and read up on the "XML Attributes" section.

Categories

Resources