Custom Spinner does not show full letter

0

good to everyone!

I have a problem with the graphic appearance of the application.

I have put two spinners, and I have put the letter of the same ones bigger by means of a layout with a TextView where I put the characteristics that I want for the letter of my spinner, in this case size of 20sp. Then in the java file when using the spinner adapter, I incorporate the size of the letter.

Well, the problem is that in the spinner the compelto text does not appear, it is cut off. I do not know if changing the size of the letter will have to change some property of the spinner to make it bigger and thus not cut the letter.

Thank you very much, I leave the code:

Layout TextView spinner:

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/text1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textColor="@android:color/green"
    android:textSize="20sp" />

Layout activity:

 <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="39dp"
        android:layout_marginTop="33dp"
        android:text="@string/seleccPlan"
        android:textAllCaps="false"
        android:textColor="@android:color/black"
        android:textSize="20sp"
        android:layout_below="@+id/relativeLayout"
        android:layout_alignParentStart="true" />

    <Spinner
        android:id="@+id/planta"
        android:layout_width="240dp"
        android:layout_height="25dp"
        android:layout_marginLeft="35dp"
        android:layout_alignTop="@+id/textView"
        android:layout_toEndOf="@+id/textView"
        android:layout_marginStart="31dp" />

Java activity code:

 ArrayAdapter<CharSequence> adapterP = ArrayAdapter.createFromResource(
                this, R.array.planta,R.layout.textview_spinner);
        // Specify the layout to use when the list of choices appears
        adapterP.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        // Apply the adapter to the spinner
        this.spPlanta.setAdapter(adapterP);
    
asked by wiki 27.10.2017 в 21:44
source

2 answers

2

The problem is with the height attribute of the spinner. You can increase it or change it to wrap_content. Greetings

    
answered by 27.10.2017 / 22:22
source
1

As you said @D. Santamaría, the problem is the height attribute of the spinner, he said wrap_content, I have put this:

<Spinner
        android:id="@+id/planta"
        android:layout_width="240dp"
        android:layout_height="42dp"
        android:layout_alignBaseline="@+id/textView"
        android:layout_alignBottom="@+id/textView"
        android:layout_alignStart="@+id/deposito"
        android:layout_marginLeft="10dp" />

both solutions are worth !! Thank you very much

    
answered by 27.10.2017 в 22:24