I'm trying to create a settings screen for an app and I like the Gmail app's settings screens. Here is a screenshot:
It looks/behaves like a custom list of some sort.
The left side looks like a TwoLineListItem (or just a large TextView and small TextView).
The right side is either a checkbox, a blank, or a downward arrow (like ExpandableListView) to indicate you should press it. (ex: when you press the Signature item, a dialog appears so you can input a signature).
I think one tricky part of this is that the entire list item is a "button", meaning you don't have to press directly on the checkbox to check it, you can press anywhere on the list item.
For example, section 5.2 of this tutorial http://www.vogella.de/articles/AndroidListView/article.html requires you tap exactly on the checkbox rather than on the entire list item.
Anyone have any ideas on how this is done?
This is not the 'normal' listView.
That UI was built with the PreferenceActivity
Always use the PreferenceActivity to display settings for your application.
Hi you can easily define an OnItemClickListener with the setOnitemClickListener() method of the ListView. The Listener is called whenever a list item is touched. In the Listener you can either show the dropdown menu or set the Checkbox to 'checked' with the setChecked(boolean checked) method of the Checkbox.
Related
I am working on xamarin.forms. I am creating an app for android. In app I have a dropdown list. I am using Picker for it. I customized it to look like dropdown. Now I need to make the first Index item to nonselactable. Means user can not select the first item. If user click on it nothing should happen. But currently when user click on the first index dropdown gets collapsed.
One more thing that I have to add in dropdown is a Cross button at index 1. Means at index 1, on left side there will be Cross button and at center there will be text like Select item. And this whole row should not be selctable. If user click at cross button dropdown should collapsed.
Anyone have idea how I can do this?
You can use listview for dropdown and control its visibility as per need.I faced similar situation where I customized list view to enact dropdown.There is another thing I want to know about Picker.Does your picker accepts or adds string only or you could customize it to accept views or controls?
I have an activity with a RelativeLayout consisting of a ListView. This ListView is populated through a custom ListAdapter. The list displays a checkbox and text for each row.
So far, so good.
I want to implement something like the default android Gmail app, where if I checkbox-select an email, the titlebar of the application at the top changes and presents options relevant to the selection (such as delete, move, archive, etc). I am not sure what to look for in the Android documentation.
Do I just create some layout above the ListView and dynamically add elements(like delete row, etc) to it on a checkbox click? Any help is appreciated!
if you have used ActionBarSherlock then you can use Action mode menu to show various option to user when checkbox is selected from listview
or
you can try
http://java.dzone.com/articles/contextual-action-bar-cab
I have a scenario where I want to programmatically change the value of my spinner using setSelection(). This works great, except that if the spinner is open (expanded?) an the time, the spinner does not close. Eg, the menu stays up, despite calling setSelection().
How can I programmatically close the spinner? I have tried performClick() to no avail.
edit: more details:
The reason I'm trying to do this is that my spinner actually uses a compound layout for each selection row. Namely, I have a linearlayout which contains an image, text, and button. The idea was that the button serves as an "edit" button (which opens an activity), while pressing on the image/text select the row (per usual).
The problem came when I added the button. Suddenly, the image & text no longer captured the press event to change the combo. In other words, adding a button to the row destroyed the touch-handling capacity of the entire row. So I tried to manually implement a click handler for the image/text, which subsequently executed a setSelection... which is where I ran into this problem.
You say that after adding the button you lost the click handle on the entire row. Try adding this android:descendantFocusability="blocksDescendants" to your row layout, and see if you can get the clicks to work properly.
I'm writing an app and I have a ListView, which items are ImageView and TextView.
I'd like to determine whether user have clicked the icon or the text to handle diferrent actions for each case. I want to achieve similar effect like in stock contacts app.
First question: How to achieve the effect wich I've mentioned above?
Second question: In the stock contacts app when we click on a photo, a fancy bubble with some actions inside appears. How is it called? Where to get it from?
Thanks.
(edit)
ok, i've found something according to my second question:
How to make a fancy transparent menu like the "share menu" in Android gallery?
The answer on your first question: you should attach onClickListeners to each of your row's views in your Adapter's getView() method. This should do it.
I am displaying a radio schedule in a List View and would like to highlight the currently playing program. I also want to allow the user to click on any program and get more details for the program. I have tried the following:
radioView.setSelection(adapter.getCurrentProgramIndex());
radioView.setSelected(true);
This does scroll the list down to the selection which is good, but it does not highlight the selection. I understand this is because the device is not in touch mode, but how then would I go about highlighting the current program?
how then would I go about highlighting
the current program?
Change something in that list row. For example, perhaps you have an icon you can switch to be a "playing" icon, or have an icon that is formerly INVISIBLE become VISIBLE, or something.
Bear in mind that you will need to have these smarts in your row binding code, so that if the user scrolls, you correct undo and redo that setting -- otherwise, row recycling will make it appear that other programs are playing.