Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8165379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:31:23+00:00 2026-06-06T19:31:23+00:00

I’m trying to put in a Spinner on each row of a ListView within

  • 0

I’m trying to put in a Spinner on each row of a ListView within a ListFragment.

I want it to look like a vertical overflow image like in the store but I’m not able to figure out how to show the vertical overflow image that is clickable to show the options.

enter image description here

It always looks like below instead. I would like to remove “Options” and have the overflow image instead.

enter image description here

Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:31:24+00:00Added an answer on June 6, 2026 at 7:31 pm

    Found relevant ideas from other posts and combined them, thank you Stack Overflow.

    Android: How to set spinner selector to own image/icon?

    Declaring a custom android UI element using XML

    How to get width and height of the image?

    The idea is that you create a 0dp width Spinner with an ImageView over it. When you click the image, it shows the drop down. I haven’t tested it’s behavior when the Spinner is at the edge of the screen yet and may very well cause trouble. I also need to tweak the position of the Spinner, but this works for now.

    My plan is to catch the selection from the Spinner and then open a dialog / intent based on what was clicked. Here is what it looks like. (the ImageView is faint but it’s mostly a placehodler for me right now)

    Before click

    enter image description here

    After click

    enter image description here

    Here is the general code I used since this seems desirable to others.

    values/attrs.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <declare-styleable name="OverflowSpinner">
            <attr name="imageResource" format="string" />
            <attr name="spinnerTextResource" format="string" />
        </declare-styleable>
    </resources>
    

    values/strings.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <string-array name="spinner_array">
            <item>Skip</item>
            <item>View log</item>
        </string-array>
    </resources>
    

    layouts/row.xml

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:awesome="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <!-- stuff -->
        <com.blah.package.OverflowSpinner
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            awesome:imageResource="@drawable/ic_menu_moreoverflow_normal_holo_light"
            awesome:spinnerTextResource="@array/spinner_array"
            /> 
    </RelativeLayout>
    

    OverflowSpinner.java

    public class OverflowSpinner extends RelativeLayout {
        int mImage;
        int mStrings;
    
        public OverflowSpinner(Context context) {
            super(context);
        }
    
        public OverflowSpinner(Context context, AttributeSet attrs) {
            super(context, attrs);
            init(attrs);
            setupDisplay(context);
        }
    
        public OverflowSpinner(Context context, AttributeSet attrs, int defStyle) {
            super(context, attrs, defStyle);
            init(attrs);
            setupDisplay(context);
        }
    
        private void init(AttributeSet attrs) { 
            TypedArray attribs = getContext().obtainStyledAttributes(attrs, R.styleable.OverflowSpinner);
            // get attributes
            mImage = attribs.getResourceId(R.styleable.OverflowSpinner_imageResource, -1);
            mStrings = attribs.getResourceId(R.styleable.OverflowSpinner_spinnerTextResource, -1);
    
            attribs.recycle();
        }
    
        private void setupDisplay(Context context) {
            BitmapDrawable bitmap = (BitmapDrawable)this.getResources().getDrawable(mImage);
            int height = bitmap.getBitmap().getHeight();
    
        // set size of Spinner to 0 x height so it's "hidden"
        // the height is used to help position the Spinner in a nicer spot 
            ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(context, mStrings, android.R.layout.simple_spinner_item);
    
            // setup spinner
            final Spinner spinner = new Spinner(context);
            adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            spinner.setAdapter(adapter);
            spinner.setLayoutParams(lp);
            this.addView(spinner);
    
            // set size of image to be normal
            lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            lp.addRule(ALIGN_PARENT_BOTTOM);
    
            ImageButton option = new ImageButton(context);
            option.setBackgroundResource(android.R.color.transparent);
            option.setImageResource(mImage);
            option.setLayoutParams(lp);
            // when clicking the image button, trigger the spinner to show
            option.setOnClickListener(new View.OnClickListener() {
    
                public void onClick(View v) {
                    spinner.performClick();
                }
            });
            this.addView(option);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to render a haml file in a javascript response like so:
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.