I'm building an android project and I'm using eclipse.
I just can't figure out how to disable the annoying auto alignment.
I just want to place buttons wherever I want to drop them on the GUI interface but it just keeps
to align them one to another. I've tried to delete those alignment lines in the xml code
but it still brings them back as I move the buttons on the GUI interface.
Is there an way to disable that function?
Thank you,
Alex
Is there an way to disable that function?
Not in a way that you will find satisfactory, I suspect.
You have not really explained what the "alignment lines" are, so we are forced to guess. My guess is that the "alignment lines" are because you are working with a RelativeLayout container. Quoting the JavaDocs for RelativeLayout, RelativeLayout is:
A Layout where the positions of the children can be described in relation to each other or to the parent.
And, quoting the guide for RelativeLayout:
RelativeLayout is a view group that displays child views in relative positions. The position of each view can be specified as relative to sibling elements (such as to the left-of or below another view) or in positions relative to the parent RelativeLayout area (such as aligned to the bottom, left of center).
Hence, the "alignment lines" are there, and are replaced by the GUI builder, because they are the point behind using a RelativeLayout container.
Of course, you are welcome to change the container that you are working with to something else.
However, in general, Android does not really support very well your stated objective ("I just want to place buttons wherever I want to drop them on the GUI interface"). Just as you don't do that in Web development, you don't do that in Android development, and for much the same reason: you need to take different sizes into account (browser window size for Web, screen size for Android). RelativeLayout, LinearLayout, TableLayout, and GridLayout are all designed to have you specify widgets plus rules for positioning and sizing, so that you can design a UI that will accommodate the difference between a 3" and a 4.5" screen, for example. This is akin to using HTML tags and CSS rules to define content and its positioning in a Web page. Eclipse's drag-and-drop GUI builder for Android can assist in your definitions of these rules, as you are perhaps seeing with your "alignment lines" for RelativeLayout.
I think I may be able to help. If you set your layout to Relative Layout you can drag and drop any of the views wherever on the eclipse GUI.
Related
I am starting to delve into Android Development and there is a lot of material online. The question is... What are the pro's and con's against the drag and drop XML design method vs coding the view manually? The only reason I ask on here is because online the views are mixed and they don't really back up what they're defending.
If I use the drag and drop method will I have issues further onto my development adventures? That is the thing that worries me the most... I don't want to learn the drag and drop method and then editting the XML to cater for my needs and then be handicapped by it.
For the beginner(s), I highly recommend not to use Drag and drop. We need to understand XML, to be comfortable with android widget. Understanding XML will come handy in future when creating custom styles and themes.
Here are few pointers before you dive in android XML layout
Try sticking with match_parent and wrap_content while defining android:layout_height or android:layout_width if possible
Make sure you have good understanding of RelativeLayout, LinearLayout and FrameLayout and how its child views are arranged.
Forget about ConstraintLayout, AppbarLayout and similar advance layout at current.
Try exploring TextView, EditText, Button, ImageView and ProressBar as far as possible.(This are most common widgets/views)
Try avoiding any tutorial related to ListView, its deprecated. Try using RecyclerView instead, it is one of the important widget that would be used in regular basis.
I want to make a similar layout in Android with two additional button in bottom right and left corner. I'm new to android development GUI. Is grid layout the best option to achieve this or I should use any other layout.
I would not suggest using GridLayout. If you can, try to use Constraints layout, if that is not an option, use combination of RelativeLayout and LinearLayout where needed.
There is no 100% correct answer, try multiple ways and you will find one that suits you the best.
I am creating an Android app in Eclipse, but when I drag around a TextView, everything below it moves around as well.
This is when I haven't dragged anything.
http://i.stack.imgur.com/Twp4L.png
This is when I drag the TextView just a bit.
http://i.stack.imgur.com/oJ75k.png
The layout designer doesn't work very well in Eclipse. You could try Android Studio's layout designer (the new early access preview), that one is a bit better, but not by much.
The most common practice is to use the layout designer to only get started with and perhaps to use the Outline view panel to tweak some of the nesting of the layouts/views by dragging some of the nodes inside it, but then it's to dive directly into the xml code yourself. There is really no other substitute for doing that. The tool just isn't very good yet.
This is called a Relative Layout. In this case, the components are placed relative to the TextView, which is not so unexpected. It depends how you set relations in the layout XML. What layout you want to achieve?
You can either set that all the components are placed relative to the whole view, or use some specialized layout types like LinearLayout. It all depends on the effect you want to achieve.
I am developing an android app with a layout that includes buttons arranged around a circular element. As the corners of said element would overlap with other buttons, the recommended layout types (LinearLayout etc.) are not a viable option.
However, I want to do this right and not use the deprecated AbsoluteLayout. So far, though, I see no alternatives. Are there?
Relative layouts would probably work depending on how you want to place your buttons.
It allows you to place the buttons to the left/right of each other or above/under, so placing them around a circular element should be possible.
Here's the link to the android documentation for relative layouts.
we are confused with designing interface file for android,we have made user interface with Absolute layout and used "dip" instead of "px" (for different screen size issue) ,but it looks like,Absolute layout has been depreciated,and developer.android, recommends not to use Absolute layout
So other option we have is to use
1.Linear layout
2.Frame layout
3.Table Layout
But we are unable to bring Combination of above layouts so,that we can make button/widgets to proper position we need
How do we make widgets to desired position of screen with above said layouts and making them compatible with different screen sizes we have in android devices
would like to get a generic answer about same,
Tools used are: DrawDroid
The best layout to use if you were considering an AbsoluteLayout is a RelativeLayout.
Check out the Android Common Layout Objects page and its explanation of how to use a RelativeLayout.
Without more information on what you are trying to do, expanding this answer anymore is useless.