is there any android dynamic treeview like c# devExpress treeview - android

I want to create dynamic treeview. But the levels of tree unknown. it's up to database.
So expandable listview not work for me,
is there any treeview example like below type in android ?
A...
->b...
->b...
->b...
->c..
A..
->b..
->c..
->d..
->d..

ExpandableListView is for sure something to look into, but may not expose enough functionality though.
Having said that: on a mobile device it may not be a good idea to show an arbitrarily deep tree, as the user a) may have issues selecting the nodes and b) may loose himself in navigation due to the reduced screen estate.
Especially for a) keep in mind that a touch point is not a few pixels like when you click with a mouse, but depending on screen resolution an area of 20x20-80x80 pixels.

Related

What is the correct way of positioning UI components

I am wondering, when creating a UI (such as main menu) and you need to position buttons around the screen, do you position things using margins(by using exact dp values) or do you align things in reference to the screen boundaries (left and right to screen..etc)
I am not asking about opinion here. I am asking about the right or the most common way.
I can see it is super easy to drag and drop components in the editor however I am always worried about different screens so I end up trying to relate everything (which takes much more time to do).
I wonder if I am doing things the wrong way
Thank you
If you want to support different screen types(for example landscape screen, different dpi versions) you can read this guide : Supporting Multiple Screens

android reservation system app

I am making an android app for a reservation system for an office. I want it so that users can click on a seat to reserve it. Also I want the seats to be color coded once they are reserved. I only have a picture of the floor map to work with. How can I do that using an image and buttons?
I'm adding this as an answer, as it seems this is really the right way to go.
Set up a relative layout. You don't need an actual graphic of the floor plan. That would complicate things in terms of screen sizes. You will almost certainly have to allow for landscape/portrait either way.
You can use imageViews and create a grid of your entire layout. Tag each of the images in the layout as row,column, like: 01, 02, 03, 11, 12, 13, etc, and indefinitely. This way you'll know which image was clicked on. Use, by default, the "available" state for each seat. Create a secondary "unavailable" version of the graphic that you can swap in later.
When a user clicks on an image, use an onClick handler from the XML to call a function that checks the seat. If it's available, run the steps to make it unavailable, and whatever other data you need to set. If it's unavailable, do nothing.
I wrote a BubbleWrap popping game a few months ago that uses this exact sort of model, and it works great. (i'd link it up here, but I do believe that remote linking/plugging is frowned upon here)
This whole answer is very much on the surface, as it is going to require research on the particulars. But this should be enough to get you moving.
A very easy implementatin would be, use relative layout, or if possible use gridlayout and arrange the buttons as the floor seats with numbers. when a button is clicked, reserve the seat, update some database or whatever to store information, and make that button disabled.

How would I go about this?(Android Whack-A-Mole Project)

I'm making a simple whack-a-mole game as my first mini-project for android. I'm not sure how to go about this. I know the basics of setting everything up and such but I'm not sure how to animate the moles and make it so that when the mole is in the up position it can be tapped and a point will be counted. I know I can do an image button and have a counter go up(counter++) but I need to be able to switch frames from the mole in the hole to the mole in the up position. Anyone have an idea as to how to do this? Thanks!
Android allows you to animate objects in a variety of ways. If you only need 2 images to switch, like a button with 'pushed' / 'not pushed' states, you can use a special type of Drawable called a selector (which allows you to specify different drawables for the various states of the target).
If you need more than two images, you may want to use the simple View animation that Android allows you to create using xml. For instance, you can create an xml animation that specifies an image to move/rotate/scale from one initial position to another, creating the in-between frames for you.
Android also has a newer, more complex and full-featured form of animation (which you probably don't need to go into).
Both of these animation systems are detailed at :
http://developer.android.com/guide/topics/graphics/animation.html
Otherwise you will need to create a series of images that you iterate through at a steady pace (which is the fundamental idea behind animation).
I've already made this before, I'll give you an overview, just check my post here: Simple Whack a Mole overview

Android Book Pages

What's the best way to implement functionality in Android where I have a large amount of text (let's say a book), and I display one page at a time. However, instead of displaying it all at once, and having the user scroll through it, I would want to create it like iBooks where each page is separate, and the user "flips" through it [although, I don't need a fancy flip. A simple slide, like Kindle for iOS, would do].
So how should I go about this? Is creating a customview necessary, or is there some way to do it without that?
Previously asked (I think): How to do page flip/turn/curl effect in android
Possibly answered: Implement page curl on android? with a project at http://code.google.com/p/android-page-curl/
If that doesn't do what you need, you will probably need a custom view, and you'll probably need to do some OpenGL work. The animation and page bending done (to simulate bending the corner of a page) is quite possible but would require some knowledge of the math, which appears to be described at the answer. Your mileage may vary.
EDIT: ah, see Android Left to Right slide animation

positioning items in android dev

Hi
I'm totaly new to android,
I'm looking for a very very very simple thing that in every possible dev env is straight forward, except apparently android.
how the hell do I set X and Y for every UI object that I wanna place there.
For example in xml i have LinearView or RelativeView and in them I have Button, I'm looking for a way to set this button position on the screen using Y and Y, should be pretty straight forward thingy, I mean in iOS dev you just do CGRectMake(x,y,width,height) and there you go.
What is the equivalent in android dev?
thanks
From Android Developers
Android is designed to run on a
variety of devices that offer a range
of screen sizes and resolutions
So, unless you are targeting only one specific Android device, you'd not want to use absolute coordinates, as, for exemple, x=300px on one device can mean a reference outside the screen on another device(a small-screen one).
Instead, you learn to use just relative positions as top, bottom, below, etc, that works on every device.
Try to do the Hello Views tutorials first, in order to better understand how things are working for Android.
Please use layout_x and layout_y with a AbsoluteLayout in your layout xml.

Categories

Resources