0

Hie. I am newbie to android platform. I have a question.

I am working with spinner. I want to customize this spinner. And I am done with that. I am facing a minor problem here.

In the below image you can see the spinner and the text within that spinner. Now here the text length is not much hence it is fitting in perfectly. But when the text length is more, then it overlaps the drop down arrow.enter image description here

Thanks in advance.

android developer
  • 1,253
  • 2
  • 13
  • 43
  • show ur layout file code – Mohit Oct 22 '12 at 07:04
  • First make sure that you have used fill_parent/match_parent for layout width. In this way you will be using the whole width of the view. In case if you have very large piece of text at first element. I would suggest you to use "select" or "click here" rather then using the application specific text(which may be long). – Mohit Oct 22 '12 at 07:12

1 Answers1

1

You can try using LinearLayout, give space to the arrow and use layout_weight to give the remaining space to the text. You can also consider to use ellipsis on the TextView if the content can be longer than one line.

The layout XML look like this (I did not test yet)

 <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <TextView
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
    >
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right">
</LinearLayout>
Ethan
  • 1,616
  • 14
  • 8