微调项中的文本对齐
Text alignment in spinner item
如何将文字移近直线?喜欢 image
这很简单,只要创建一个xml文件,命名为spinner_item.xml,内容为
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#111111"
android:padding="10dp"
android:textAlignment="center"
/>
现在在您的 java class 中,不要添加 android 的默认视图资源,而是将您的自定义视图资源添加为
ArrayAdapter<String> adapter= new ArrayAdapter<String>(context, R.layout.spinner_item, myList);
adapter.setDropDownViewResource(R.layout.spinner_item);
如何将文字移近直线?喜欢 image
这很简单,只要创建一个xml文件,命名为spinner_item.xml,内容为
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#111111"
android:padding="10dp"
android:textAlignment="center"
/>
现在在您的 java class 中,不要添加 android 的默认视图资源,而是将您的自定义视图资源添加为
ArrayAdapter<String> adapter= new ArrayAdapter<String>(context, R.layout.spinner_item, myList);
adapter.setDropDownViewResource(R.layout.spinner_item);