Hello. Such a problem. Spinner cuts the string. More precisely, the line does not completely fit into the open spinner.

activity_main.xml

<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <Spinner android:id="@+id/spinner" android:layout_width="0dp" android:layout_height="50dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintWidth_percent="0.3"> </Spinner> <TextView android:layout_width="0dp" android:layout_height="50dp" android:text="Hello World!" android:textSize="40sp" android:gravity="center" android:background="@color/colorPrimaryDark" app:layout_constraintRight_toRightOf="parent" app:layout_constraintWidth_percent="0.7" /> </android.support.constraint.ConstraintLayout> 

MainActivity.java

  import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.Spinner; public class MainActivity extends AppCompatActivity { Spinner spinner; ArrayAdapter<CharSequence> adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); spinner = findViewById(R.id.spinner); adapter = ArrayAdapter.createFromResource(this, R.array.list, R.layout.spinner_close); adapter.setDropDownViewResource(R.layout.spinner_open); spinner.setAdapter(adapter) } } 

spinner_open.xml

 <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/spinner_open" android:gravity="center" android:textSize="26sp" android:padding="10dp" android:layout_width="match_parent" android:layout_height="wrap_content"/> 

spinner_close.xml

 <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/spinner_close" android:gravity="center" android:textSize="16sp" android:layout_width="match_parent" android:layout_height="wrap_content" /> 

enter image description here

Has anyone encountered this problem?

  • Screen would add - Alex Tremasov
  • Screenshot added. - Ikibana pm
  • Lay out the <Spinner ... /> code itself and the visual presentation on the screen before clicking on it, and preferably the full XML code of the file representing Spinner - Alex Tremasov

0