Hi,

meanwhile I got help from someone other, he said:

hello,


> I remembered that I checked the source of android then,


> http://goo.gl/iLvvj


> I found that it use the CheckedTextView


> so you can use this either add image next to it or extend it to add more
> feature to TextView


> Do that help you?



there has been a long time since now, feel sorry if I depict anything
> wrong:(


tomorrow I will have a look at the sources to convince myself of the
solution. Like you said, poohtbear it is the right way to look how Google
does with it's implementation.

But now its really late, I am tired and try this tomorrow. I'll give
responses ;-)
Thanks you for further help!

-Danny Schimke

2010/12/6 Danny Schimke <[email protected]>

> Hey poohtbear,
>
> thank you very much, I am downloading the sources you prepared for version
> 2.2. Maybe I find out more... Can't estimate how long I need for this, but
> I'll give response to this post asap. You are right, maybe I need to have a
> look at the originally used layouts. I am really confused at the moment why
> it does not work. If I replace the RadioButton with a TextView it works, but
> RadioButton or CheckBox does not work. It seems they corrupt the
> functionality of the item.
>
> Thank you for helping me!
> -Danny Schimke
>
> 2010/12/6 poohtbear <[email protected]>
>
> i'm not sure regardin of why it doesn't call what it should.
>> First of all you should know that the code including the layouts and
>> resources of the SDK are available to you online here:http://
>> android.git.kernel.org/?p=platform/frameworks/base.git;a=tree;f=core/
>> res/res;hb=donut-release2<http://android.git.kernel.org/?p=platform/frameworks/base.git;a=tree;f=core/res/res;hb=donut-release2>,
>> this is a link to donut version resources.
>>
>> the drop down and the view supposed to be different, one is for the
>> spinner itself, for the single item that is displayed, the other is
>> for the items in the list one the spinner is 'opened'.
>> I urge you to take a look on the theme.xml and styles.xml and layout
>> directory to see which of the layouts is used originally in the
>> Spinner class
>> and try to build your layouts from there.
>> I had in my blod a zip with the source for 1.6, 2.1 and 2.2 though you
>> can still view them online i think i' can find the link:
>>
>> http://www.devfrustrated.com/devBlog/browsing-android-source-code-in-eclipse/
>> in there in the end you got 3 zips, in most cases you can debug the
>> code... in the evening i'll have some more time i might be able to
>> look into it so you can send me the layouts :-)
>>
>>
>> On Dec 6, 1:49 pm, Danny Schimke <[email protected]> wrote:
>> > Hi poohtbear,
>> >
>> > I have no android source and I am using windows as development platform.
>> As
>> > far as I read I am not able to get the source under windows?!
>> >
>> > But based on your code I noticed, that the XML of my Spinner view and
>> its
>> > drop down XML are different. The drop down XML has an additional
>> > RadioButton. If I use the same UI as I am using for my Spinner it works,
>> but
>> > it does not look very well... It seems the onClick() of the spinner is
>> never
>> > called. If I call performClick() when click on the RadioButton the drop
>> down
>> > menu opens again. A dismiss is not called, also when the drop down is
>> shown.
>> >
>> > Is there a way to use the default dropdown UI with radio buttons and
>> fill it
>> > up with custom view elements on the left side?
>> >
>> > Thanks a lot!
>> > -Danny Schimke
>> >
>> > 2010/12/6 poohtbear <[email protected]>
>> >
>> > > That's a bit strange.
>> > > According to the code of spinner:
>> > >  @Override
>> > >    public boolean performClick() {
>> > >        boolean handled = super.performClick();
>> >
>> > >        if (!handled) {
>> > >            handled = true;
>> > >            Context context = getContext();
>> >
>> > >            final DropDownAdapter adapter = new
>> > > DropDownAdapter(getAdapter());
>> >
>> > >            AlertDialog.Builder builder = new
>> > > AlertDialog.Builder(context);
>> > >            if (mPrompt != null) {
>> > >                builder.setTitle(mPrompt);
>> > >            }
>> > >            mPopup = builder.setSingleChoiceItems(adapter,
>> > > getSelectedItemPosition(), this).show();
>> > >        }
>> >
>> > >        return handled;
>> > >    }
>> >
>> > >    public void onClick(DialogInterface dialog, int which) {
>> > >        setSelection(which);
>> > >        dialog.dismiss();
>> > >        mPopup = null;
>> > >    }
>> >
>> > > if the AdapterView is not handling the performClick then a new alert
>> > > dialog that derives it's views from your adapter is created, and the
>> > > spinner is the onClick listener.
>> > > So when you click an item is should have dismissed the dialog.
>> >
>> > > do you have the source code to put break points and debug it ?
>> > > On Dec 6, 11:13 am, Danny Schimke <[email protected]>
>> > > wrote:
>> > > > Hi,
>> >
>> > > > I googled a long time and still got no solution for my issue. I
>> > > customized
>> > > > my spinner view and the spinners dropdown menu. Within the spinner
>> itself
>> > > I
>> > > > show a color representation and a simple text (I kicked some
>> attributes
>> > > to
>> > > > save space in this post):
>> >
>> > > > spinner_color_item.xml
>> >
>> > > > > <?xml version="1.0" encoding="utf-8"?>
>> > > > > <LinearLayout xmlns:android="
>> > >http://schemas.android.com/apk/res/android";>
>> > > > >     <View android:id="@+id/vColorCode" />
>> > > > >     <TextView android:id="@+id/tvColorName" />
>> > > > > </LinearLayout>
>> >
>> > > > My dropdown menu (one item element in the menu) looks like this:
>> >
>> > > > <?xml version="1.0" encoding="utf-8"?>
>> >
>> > > > > <LinearLayout xmlns:android="
>> > >http://schemas.android.com/apk/res/android";>
>> > > > >     <View android:id="@+id/vColorCode"  />
>> > > > >     <TextView android:id="@+id/tvColorName" />
>> > > > >     <RadioButton android:id="@+id/rbChooseColor" />
>> > > > > </LinearLayout>
>> >
>> > > > Everything looks fine, the spinner is shown as expected and the
>> dropdown
>> > > > menu items look like I wanted. I am using a customized ArrayAdapter,
>> for
>> > > > models that look like:
>> >
>> > > > public class ColorItem {
>> >
>> > > > >         private String colorName;
>> > > > >         private int colorValue;
>> > > > >         private boolean selected;
>> > > > >         public ColorItem() {
>> > > > >         }
>> > > > >         public ColorItem(String colorName, int colorValue) {
>> > > > >             this.colorName = colorName;
>> > > > >             this.colorValue = colorValue;
>> > > > >         }
>> > > > >         // some methods (getter and setter)
>> > > > > }
>> >
>> > > > The code within my onCreate method looks like:
>> >
>> > > > spiColor = (Spinner) findViewById(R.id.spiGroupColor);
>> >
>> > > > SpinnerColorAdapter colorAdapter = new SpinnerColorAdapter(this,
>> >
>> > > > > android.R.layout.simple_spinner_item, prepareColorItems());
>> > > > > spiColor.setAdapter(colorAdapter);
>> > > > > OnItemSelectedListener l = new OnItemSelectedListener() {
>> > > > >     @Override
>> > > > >     public void onItemSelected(AdapterView<?> arg0, View view, int
>> > > > > position, long id) {
>> > > > >         // never called. Why?!
>> > > > >         if (spinnerInitialized) {
>> > > > >         }
>> > > > >         spinnerInitialized = true;
>> > > > >     }
>> > > > >     @Override
>> > > > >     public void onNothingSelected(AdapterView<?> arg0) {
>> > > > >     }
>> > > > > };
>> > > > > spiColor.setOnItemSelectedListener(l);
>> >
>> > > > I overwrote the getDropDownView method of my custom adapter. The
>> view is
>> > > > created successfully, how I defined in xml, but I want to close the
>> > > dropdown
>> > > > menu after selected one item, so I want to close it with clicking
>> the
>> > > > radiobutton of one item. Set the selection works very well, but I
>> have to
>> > > > exit the menu pressing escape in my emulator.
>> >
>> > > > Hope someone can help, I need a way to close the dropdown menu
>> > > > programatically. Does anybody have the same problem?
>> >
>> > > > Thanks a lot!
>> > > > -Danny Schimke
>> >
>> > > --
>> > > You received this message because you are subscribed to the Google
>> > > Groups "Android Developers" group.
>> > > To post to this group, send email to
>> [email protected]
>> > > To unsubscribe from this group, send email to
>> > > [email protected]<android-developers%[email protected]>
>> <android-developers%[email protected]<android-developers%[email protected]>
>> >
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/android-developers?hl=en
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]<android-developers%[email protected]>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to