I'm developing an application and I am facing a problem using ExpandableListView. What I'm trying to do is, in GroupHeader, not only show the group name, but also an spinner with options. That's because I want to show the football second division games in the list but, also, give the option to choose the round, in case the user wants to check older/future games. SO far I have that
As you can see both, title and spinner, shows. Also you can see the arrow on the right which is supposed to expand the list. Problem is that, if I click, only spinner opens, group expand button doesn't. So, here is my question, how can I make both of them work depending on where you click (one or another)??? Is that possible?
Also I must say that if I only place the TextView with the group name works perfect. If I only place the spinner, the problem persists. So I'm guessing that's a focus problem.
Btw: grey areas are the layout backgrounds, so no, they are not hiding behind the button.
I found the solution, I just neede to add this line android:descendantFocusability="blocksDescendants" to the Main Layout of the xml where I define the GroupHeader elements.
Related
I'm playing around with Android spinners. I'm not 100% sure if I can get the behavior I want using a spinner, but it's the most obvious choice that comes to mind.
I need something of a dropdown view, the title of which says "x of y selected".
The options in the dropdown would look like:
-All
-None
-Special items only
On clicking one of the dropdown items, the title is reconfigured such that 'x' changes.
It would be ideal to use a spinner, but somehow, it seems that android puts in the first value of the spinner to always be the first values in the list of strings you pass it, and I clearly don't want the title item to be shown in the dropdown list for my case.
Another approach that I came across was to perhaps use a button with a popup with these items in the popup.
Would that be a better approach, or can I actually achieve the behavior using a spinner, or is there another view that would better serve my purpose?
I'm going to redirect to this post, after a lot of searching I found what I was looking for:
How to hide one item in an Android Spinner
The answer by Aebsubis, and make sure to set the text view height to 0. I'll update this answer with more code, once I'm done with tweaking it for my purposes.
In my application I currently have an xml layout that is re-used to enter information 6 times (these are turns in a game). This works fine. At the end of the round I present a screen that has a summary of each turn. I want to implement a button beside each turn to "edit" that turn. There are 3 possible things that can be edited. Ideally an alert dialog or something like a "popup" would be idea for this.
Would I be best off to have 3 buttons per "turn" for editing or is there a way to do this with a popup?
Thanks for your input on this matter.
You could list each turn and it's information with a single edit button next to each. When the edit button is pressed, create a new activity (intent) that prompts for all three pieces of data.
You have several options (and probably more I'm not thinking about). If these are in a ListView (or even if not) you could use a ContextMenu. You could have options in here to change the selected item or others. This would show a popup when the user long clicks the item
A PopupMenu can give you a similar effect that can pop up a list of options when the user clicks on a Button. Note that this requires API >= 11
You also could use an AlertDialog, as you mentioned. But just from what little I know about what you are trying to do I'm not sure this is what you would want.
Again, I don't know enough details about what you have or want but I would say that one of the first two options would suit you best. As far as one Button or multiple Buttons, that depends on the layout that will work best for your app, I suppose. You certainly could have one "Edit" Button which uses something like a PopupMenu and allows the user to choose what to edit. I hope this helped a little.
I want a custom layout drop down box for my app as if like i am on my homepage and i press a button that's in center of page and then this layout should appear after i press that button, i tried several other and searched the internet but i was unable to get an idea on how to make a drop down box like this :
this shows like two kinds of layout first one we pick the date like 12 months in first column , then 1-31 numbers and then the year from 2001-2012, i don't get and idea that how can make this effect like glassy one i wanted to make like exact same layout as shown here, can any one please suggest me how to implement that coding will me much helpful.
There is an example you can refer this one
http://code.google.com/p/android-wheel/
you can get source from here for that
http://android-wheel.googlecode.com/svn/trunk/
another example
https://github.com/sys1yagi/AndroidPractice/tree/master/DrumPicker/trunk
Goal: have a LIstView show a list of text strings. The user can select an item by touching it. The selected item is visibly different to those not selected.
In short I want to have a simple scrolling list box that works using trackballs AND touch mode.
There are many posts asking for this, but none seem to get an adequate answer. This is such a simple requirement, why is there no article on this?
I looked at http://developer.android.com/resources/tutorials/views/hello-listview.html but that won't work in touch mode: the orange background is displayed, something unachievable in touch mode without extreme geek wizadry, for something that is quite frankly what all newbies expect out of the box.
I suspect that the only way to achive a touch mode selectable listbox (ListView in google speak), is to stick radio buttons in there. All of a sudden my little text list view is beccoming a monster.
Can anyone explain the simplest way to do a single choice ListView that displays the item selected so the user can figure out that it is selected, in touch mode? After fumbling for days, I really am not fussed if it has radio buttons, singing cockatoos, or whatever, so long as it's simple to code.
Here's the example that Google provides:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List10.html
It uses radio buttons
Wat do u want to do? Just highlighting the row in the ListView which is selected.rt? for this u can use this.
android:listSelector="#drawable/highlighter"
android:drawSelectorOnTop="true"
Write this code in your XML file
I have a layout of a user entry form.when i enter username and password and hit the submit button.the content should be saved and another div with three textboxes and editboxes should appear in the same page.
Replacing the content might not be the best solution.
Anyway, you can create all these elements together in the same layout and set the "div with three textboxes and editboxes" initially to "hidden".
After you have clicked the button and triggered the desired event, you grab the desired elements and make them visible while setting the unwanted elements to hidden again.
Charles Merriams answer would be the more elegant and cleaner way, this only answers the "base" question.
The magic word you need to look at is "Intent". You call your own application in order to switch layouts after the submit button.
You may find the Notepad tutorial useful.
You can try what DrColossos said or you can try by just setting a different contentview on button click.