Custom Spinner TextView is being cut off

2019-07-04 21:23发布

So in the attached screen shot and the code sample you can see my custom spinner. As you can see my text is getting cut off no matter what I try to do. The nine patch image is set up correctly with the text padding on it too. I have right just about everything and am at a complete loss...

Custom spinner

<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/spinner"
android:textColor="#555"
android:textSize="22sp"
android:textStyle="bold"
android:typeface="normal"
android:layout_width="wrap_content"
android:layout_height="40sp"
android:gravity="center_vertical|left"
android:singleLine="true" />

Implementing custom spinner

<Spinner
    android:id="@+id/spinner_both20"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/b_both20"
    android:layout_alignTop="@+id/b_both20"
    android:layout_marginLeft="4sp"
    android:layout_marginRight="5sp"
    android:layout_toRightOf="@+id/b_both20"
    android:background="@drawable/buttons"
    android:padding="20sp" />

Java

ArrayAdapter<CharSequence> aBoth = ArrayAdapter
            .createFromResource(getActivity().getApplicationContext(),
            R.array.d20both, R.layout.spinner_settings)

I'm super frustrated to be spending this many hours on something so simple. Any help would rock!

enter image description here

1条回答
够拽才男人
2楼-- · 2019-07-04 21:47

Padding will cut cut into your inner text.

查看更多
登录 后发表回答