简体   繁体   中英

How to remove extra whitespace in Spinner android?

See Attached below image I want to get rid of extra white space after +41 because the Mobiltelefonnummer text gets trim.

在此输入图像描述

Tried adding android:padding="0dp" and android:marginStart="0dp" and also added below code:

public View getView(int position, View convertView, @NonNull ViewGroup parent) {
       View v = super.getView(position, convertView, parent);
       v.setPadding(0, v.getPaddingTop(), 0, v.getPaddingBottom());
       return v;
   }

The above code dint worked at all

//layout

<Spinner
        android:id="@+id/spinCode"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"/>

//textview.xml

<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/simple_spinner_text_quantity"
    android:paddingTop="5dp"
    android:paddingBottom="5dp"
    android:paddingLeft="20dp"
    android:paddingRight="25dp"
    android:gravity="start"
    android:textAlignment="gravity"
    />

TextView删除左右填充或将其缩小,如5dp

从textview中删除左侧填充和右侧填充,您的问题将得到解决。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM