Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I Developed An android game Using OpenGlEs
Now I want to Create its UI And Main Menu Items, Im currently using relative Layouts to create the menu, Buttons and their Animation, But since i have many items in my menu, it is trouble to work with,
What is the best way to implement GUI in android? should i keep Going with layouts or work with Canvas and SurfaceView?
It depends on your choice if you just want to choose between XML based and custom Views.
XML based layouts easy to design, so you can quickly implement those, You can have basic animations with them but no complete control over the drawing mechanism. Straight forward control to Inputs.
While Canvas and SurfaceView approach requires you to do all the drawings and then handle Inputs, this way you can have full control over drawings but it adds more complexity to code side.
You can choose what suits your need , on the other hand, if you have too many views ie too many button etc. You can simply try switch statement and applying distinct width/height to each element or use onTouchListener to get coordinates of touch and respond (supposing you already know coordinatesbof all views) hope this helps.
If you're looking for an easy way to create UIs for Android, Eclipse and Android Studio both provide a WYSIWYG UI creator. I have not used it yet but it should be fine for layouts which do not need significant customization. If all you're doing is creating simple menus/text/buttons then this should serve you fine, no need to use anything more complex than the Views/Layouts provided by the Android API.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I'm learning Android development in Android Studio. My question is that what is the best way to make UI for Android apps. I'm right now learning coding to make the UI of apps. It's a hard or time-consuming process but I find that this is another way to create UI of Android apps via the drag or drop feature. So, I want to ask which one should I choose to create UI of apps ?? because I want to work as an Android Develper.
Thanks yo
Drag and drop are useful when you don't have to make a good/presentable UI, You are just in hurry to check/test something. But for long term or to make reliable UI, I'd suggest you go with writing code in XML. This helps you understand the concept of how things stick to each other and you can make changes easily when needed. All the best.
Try Constraint Layout ,It's very flexible and will help you understand the concept of constraints.
If you want to become an Android developer, you have to practice a lot, the drag and drop feature on the xml layout design is very useful, but it would be nice if you also have to master the attributes and components in the Android layout. It depends on usage, but I would rather write the xml code directly to better understand the points of layout on Android. Keep learning and keep up spirit
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
Kind of new to programming, especially with apps
In Android Studio, which is the 'proper' way of designing the UI? The drag-and-drop or manually through code? (Design or Text)
Also, is AndroidStudio the best way to code for apps?
Sorry if its a silly question, new to this stufff
Drag and drop may make a lot of sense when combined with appropriate coding in xml. As #Rai said, it is important to learn how things work via code in xml - but I would like to add that learning things in xml will make the transition to editing views programmatically (dynamically in your java classes), much easier.
Sometimes, however, such as when you are using a constraint layout (a more advanced but very useful layout to use that improves performance in many cases), it is a lot more efficient to get the look you want in the design tab. Check out this tutorial: https://developer.android.com/training/constraint-layout/index.html
In general you should make sure you UNDERSTAND what you are doing when you are making android apps (and coding in general), because if you are just messing around in a design editor you may end up doing things that slow down your user experience and can be done more efficiently. As long as you understand what you are doing (and it is legal) doing whatever is efficient for you as a developer and for your user experience is what is 'proper' - it is an engineering disciple after all.
You should use android studio 2.3x when you are starting out. It used to be true that eclipse was used, but now Google wants you to transition to android studio.
You should not rely on drag-and-drop. Its better you know manually
what a code does before you use drag-and-drop functionality. For
me in android drag-and-drop is not that usable. You should learn all
the attribute, properties and know the relationship between views by writing it manually rather than
using 'drag-and-drop' and ask yourself at the end how UI works and
rendered.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
It should be easier to use the design tab when designing an app, as you can drag and drop and it is more intuitive, but it seems many developers rather prefer to use the text tab (write the design in code).
Furthermore, in the Udacity course videos I'm currently watching they teach you to design the app using code.
Any special reasons why one is preferable to the other?
In my opinion you should omit using designing your layouts with the visual editor as much as you can. You might be tempted to use it at the beginning of your "android journey", but it won't do you any good in a long term.
Using text editor will basically make you understand layouts. How they work, how Views influence each other. If you learn that, I assure you, making a layout with the text editor will be much, much faster than using the visual designing tool.
I personally never use this tool (the visual one) for creating a layout. Sometimes I'm just peeking at the Preview window (while writing in a text editor) to see if everything goes as planned.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
This question has been bugging me for a while now.
The idea is that I want to use a way to draw/create a view in a fast way.
I read that XML layout has more advantages than a dynamic one.
I read also about caching. Apparently, we cannot/shouldn't cache the whole UI element. If we save its state/value and re-create it, doesn't it take the same time as creating it from scratch? Is there a significant way to draw a view in a faster way?
What's my goal?
Say if I have different activities in an android app; the second time I visit an activity, I want it to "render" faster to optimize the performance and usability. Is there a way, like caching for example, or any other way? Or am I stuck with re-creating each activity from scratch from XML Layout or programmatically?
Thanks in advance for any thoughts..
the second time I visit an activity, I want it to "render" faster to optimize the performance and usability
Well, it will do that to an extent on its own, as your resources will already be loaded into the process.
You can also bring an existing instance of the activity to the foreground, creating a fresh one if there is no currently-running instance, via things like FLAG_ACTIVITY_REORDER_TO_FRONT. However, that's more of a way of controlling navigation, more so than specifically addressing performance.
You are also welcome to minimize your number of activities, going with more of a "fat activity" architecture, heavily leveraging fragments, where you can do a bit more caching of actual views.
If you have existing code that is exhibiting performance issues, use tools like Traceview to figure out where your time is being spent, rather than just guessing.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am using Absolute layout for my UI design in android.
My doubt is which layout is best for UI design in android and Is it the design is change in any other device. That means i am using HTC Desire to test my application if i installed my app in any other app means the design is change or look like same
Thanks in Advance
AbsoluteLayout is definitely worst-practice for android.
Get to love the RelativeLayout. It will make your life much easier, when designing for multiple resolutions/densities. If you have an old SDK, update your eclipse plugin. It has graphical snap-lines for RelativeLayouts similar to designing a form in Visual Studio, so you can see what is anchored where. It's really quite good.
Do not use AbsoluteLayout! The Android Doc says:
This class is deprecated. Use
FrameLayout, RelativeLayout or a
custom layout instead.
Those layouts will adapt to different screen sizes, whereas AbsoluteLayout will not.
I always go for LinearLayout over all other layout.Working with RelativeLayout is very hard as all the components are placed relatively to each other so if you want to move a component slightly you will have to sweat it out!!
Depends on your design. It's a nice question. Layouts are a very important concept of desiging. I usually prefer linearLayout and relative layout.
Use frameLayout if you want to display a textView on an ImageView and don't worry about different handsets. It will adapt accordingly. Study Nine-patch image.