The layout of my spinner while close is adopting the layout of the layout configured to each row of the spinner.
The layout for each row is defined inside getCustomView method because I am using a custom adapter to the spinner, here it is define:
public View getCustomView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater=getLayoutInflater();
View row=inflater.inflate(R.layout.row, parent, false); //here is the layout for each row -> R.layout.row
//there are more things here but doesnt matter for the question..
}
On that layout (row.xml) I have margins top and bottom, because I want to give soem space between the choices.. But then the button itself of the spinner, I mean, the layout of the spinner while closed also has the margins.. and it looks larger than what I want.
It is possible to define different layouts?
I tryed to make the spinner layout at xml using less height, but then I can see the option clearly.. because it has margins..
Did I make myself clear?
Thanks alot in advance.. If someone didnt understand I can explain better.
Thanks ;)
Finnaly found a solution to this problem :)
Didn't know that getDropDownView was for the dropdown layout and the getView was for the single layout, at closed spinner...
Solution here: Android Spinner with different layouts for "drop down state" and "closed state"?
Related
I searched lot on internet to find a solution for my problem but I haven't found a answer. I hope someone can help me.
I have a Android application where I made a fragment with 3 tabs. Every tab had a different layout and in every layout there is a listview with different id. The problem is that, when i click on item of listview, only the item of the first tab take focus and background was set to green. In the other tabs the item is selected but focus don't change the background item color.
I had clear the focus on the first tab if was selected but this don't resolve the problem.
this is the code that I implementer on tab
listView.setAdapter(adapter);
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
listView.setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> arg0, View view,
int pos, long arg3) {
view.setSelected(true);
selectedBusiness = businessList.get(pos);
buttonModify.setEnabled(true);
}
});
Any idea?
Thank Max
I found the solution.
The error in my case was made from
ArrayAdapter adapter = new ArrayAdapter(getActivity(), R.layout.my_business_item);
I don't know why but the problem was the layout. In the other two tabs, I used the adapter with another layout android.R.layout.simple_list_item_1. With this layout the focus dosen't work. With my simple layout it works.
I am trying to add a Toolbar that is anchored to the bottom of a MonoTouch Dialog.
Here is an example:
So as you scroll, the table's contents scroll but the toolbar at the bottom remains in view always. I know how to do this by using the interface builder, but no clue as to how to do this with Mt.D. Please please tell me it can be done!
To do this, it's probably easiest to use the DialogViewController and its View as a child of another UIViewController.
Just create your public class MyViewController : UIViewController class and then create and size your child views in the override ViewDidLoad method.
I have a scroll view, and when a user moves from one imageview to the next, I want the title in the navigation bar to change. So I want to set a new title for the navigation bar for each image in the scroll view. How would I go about doing this?
Thank you very much for your help.
Write a delegate for your scroll view. In the delegate, implement the scrollViewDidScroll: method to figure out which image is currently visible and change the title.
To eliminate your incompatible type warning, you can declare that ScrollViewController adopts the UIScrollViewDelegate protocol:
#interface ScrollViewController : UIViewController <UIScrollViewDelegate>
If I have a xml file linear layout with CheckBox, TextView and ImageView and want this to display as scrollable list, having different name and different pictures in every rom of ListView , how can I do it. I am really confused, can you please help me understand. Thank you.
What you're trying to achieve is a custom list row. There are plenty of examples around:
http://appfulcrum.com/?p=311
http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/
I have an application made by a UITabBar with three tabs. One of these is a UIViewController in which I implemented the willRotateToInterfaceOrientation to change the orientation and position of my views.
Everything works except when that view is not the currently shown. In that case willRotateToInterfaceOrientation is not invoked and my views are not set. Which is the best place where to set the new positions and sizes of those views when that tab is not the shown one? How would you implement this?
Thanks!
Just in case anyone else need this, I solved simply by setting the frames in the viewWillAppear method of the UIViewController, in case the orientation has changed.