当我减少微调器的layout_width和layout_height时,项目名称被剪切。我想要在不影响项目names.How的情况下减小微调器的大小?
发布于 2013-02-18 19:59:55
在为您的微调器创建Adapter时,给出自定义布局而不是预定义布局
创建名为spinner_row.xml的xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/cust_view"
android:layout_width="match_parent"
android:textColor="@color/black"
android:textSize="12dp"
android:layout_height="36dp"
android:gravity="left|center_vertical"/> 在这里,您可以通过修改此文本视图来更改微调器中元素的颜色、文本大小以及宽度和高度
在创建适配器时像这样使用它
ArrayAdapter<String> adapter=new ArrayAdapter<String>(context, R.layout.spinner_row,yourlist);最后一个任务是例程
spinner.setAdapter(adapter);我希望这能对你有所帮助。
https://stackoverflow.com/questions/14935528
复制相似问题