DISABLE the auto arrange of widgets in eclipse - android

I'm fairly new to android programming (making the switch from Windows programming to Mobile Platforms.)
Problem: Every time I add, let's say, a text view, I get a green box around it that will put it in a location. When I add multiple text views, I go to place it down under another text view and everything in my app shifts, and moves everything into a stack on the upper left most part of the screen. It seems like every time I move one thing, 5 other things move with it.
Question: Is there a way to disable that function?

Go to your layout, right click it, then click on change layout. I changed it to absolute layout so I can move any or my widgets around the screen as much as I wanted without the movement effecting other widgets. Hope this helps

Android forces you to develop without a pixel-rigid notation. Basicly you have a set of Layout types (Linear, Relative, etc) that stablish a relation between the child's elements.
Therefore, it is important to know those Layouts, how can you connect them and how their childs are arranged.
In eclipse you can add elements but some things eclipse doesn't know how they are related. Eclipse will update the new data, and therefore moving all kind of views out of the way to update into the new hierarquy you defined. Therefore you can't remove "auto-layout". Even if you change to Absolute Layout (like David suggested) you are not removing the "auto-layout" feature. You are simply telling eclipse that you want to arrange your things with absolute positioning. However, absolute positioning is not advisable since you have several devices with different resolutions.
I advice you to read some information about Layouts and then try to use the XML. Don't be afraid. It can become quite easly. Actually, I prefer XML to interface builder in eclipse. After you get some idea how layouts work you can use make a better use of the interface builder.

Related

how to create a crossword puzzle shape in android

I want to create a crossword puzzle using android studio. the problem that I run into is I can't figure out a good way to draw the crossword puzzle the crossword
upon selecting a word from that shape. the user will access an interface that is designed specifically for that word. where to enter the answer
The problem I have is how to actually create that crossword shape, especially since I need it to be created dynamically afterwards based on the supplied data.
After 15 days of research all I can find are those possibilities:
Using Table layout with each cell representing a character. But this approach is not appropriate and not optimate and create many problems.
Using GridView with the unused cells set to be invisible. this is better but I think there is a better way than creating Grids only to set most of it to invisible.*
**I am sure there is a better way, but can't figure it out.
I know I have to give a code sample for what I have but I can't even do that till I know what approach I need to create this. If there is any suggestion to make my question clear that will be welcomed as well.
Neither. This calls for custom view for the word grid. While you can probably get it to work without one, it's going to look very amateurish, and you're going to be very hacky. Instead, you'll want a totally custom view doing its own keyboard input handling. Unless this is like a school project where looks and UX don't matter and you just need it done.

Android Studio & Constraint Layout Editor Problems

I have watched numerous videos, including Google's own, and i'm really struggling with ConstraintLayout, it simply doesn't work for me, like it works in the online videos.
When I drop a textview onto the constraint layout editor, it jumps to the top right of the form. In the demo videos, it stays where it's dropped, and it's easy for those people to set up the relationships by dragging handles. For me, It's all up in the top right, and I can only get to 2 of the handles.
It gets worse if I then drop two more text views into the form, they are all now all the same size and all overlapped at the top. Whenever I use constraint layout, I end up tearing my hair out, and then giving up and going back to an older layout.
I really want to use constraintlayout, but clearly I am missing something really obvious here, but I can't figure out what.
Yes the drag and drop doesn't work well. For me I just use several steps to add a new view:
1. drag new view to the end of the view list window (not on the design view! design view will add unnecessary properties and is not clean)
2. select the new view, and name it! name is very important to constraint layout.
3. set the layout_constraint_xxx attributes from the property window
then it goes to the expected places.
Try disabling the experimental render engine and re enable it again

What is the simplest layout to choose to make book finder app?

I want to make very simple book finder app for a website.
The prototype is this(how i want it to look like):
I have chosen grid layout, but the search field keeps jumping around, i think the problem is the layout(maybe wrong)
Question: what layout do you recommend for this simple app?
GridLayout or TableLayout will work fine, but you can also use a combination of LinearLayout (one vertical and one horizontal).
If your app stays simple, it is easier to use LinearLayout.
I am not sure I answered your question.

Enormous form: how can I do it in Android?

I'm developing an Android Tablet application with Android 3.1 SDK.
I have to implement a form in an Android Tablet. Now I'm doing on one screen with TableLayout, TableRow, TextView, Spinner, buttons, etc.
At this moment I have more than 80 views and then I get a warning about it.
The form is divided into sections and I think I can divide it into tabs but I don't know if I will have the same problem (I'm very new on Android development and now I learning how tabs work).
What do you recommend me? I will have, probably, 160 view or more.
I recommend that you split this huge form into multiple screens / steps somehow, it seems much more useable and managable to me. You could use fragments to hold the steps, and use some paging mechanism to navigate between these fragments. By switching fragments and saving their state you can keep the number of Views on the screen relatively low.
Check out the ViewPager component for this to navigate between fragments by swiping. Or you may use the plain old button based navigation (next/previous step e.g.).
If you really need to display all the form elements on one screen and want to keep the number of instantiated Views, you may be able to do this by using the virtualizing ListView, though it seems quite awkward to me. ListView constructs the rows as needed during scrolling, and you need to tell its adapter that you have X type of rows where X is the number of form-parts.
Why don't you logically break this Enormous form and using something like a Next button show the form in multiple activities. This would keep the screen clean, won't bombard the user with too much of information and finally won't give the warning of excess views on screen.

Android horizontal scroll programmatically

In Android, I want to create a particular control which may require to set the location of a component by fixed coordinates.
This is what I want to do. These screenshot are taken from a swing application of mine. I want to clone the buttons on top and their behaviour, into an android application. Basically if there are too many buttons in the menubar, left and/or right arrows appear, and clicking on them will scroll horizontally to access the hidden buttons.
I need to be able to set the coordinates of an horizontal linear layout inside another one, and even to set negative coordinates in order to scroll on the right.
I'm doing this using a null layout in swing. Can I achieve this with Android ?
I'm not sure if an HorizontalScrollView can do this. Could someone point out a good tutorial or something related to what I'd like to do.
I think a HorizontalScrollView can achieve what you intend to do with your Menu Bar. You don't need these "scroll" Buttons, because a user can swipe the menu.
You can nest LinearLayouts together, however you want. if you want to control their flow try to apply margins to them. You can set fixed Coordinates in an AbsoluteLayout, too.
Consider using a gallery? If not gallery, then a child or cousin of it. As far as I know, there is no ViewParent that will allow what your are shooting for.
Hope that helped ~Aedon

Categories

Resources