我正在为Spinner DropDownview
使用自定义布局,它具有棕色背景和白色字母。我想删除视图1底部的一些白色条纹,但我也不知道为什么它们会出现。
这是我用于spinner_dropdown_item
的代码:
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/text1"
style="?android:attr/spinnerDropDownItemStyle"
android:layout_width="match_parent"
android:layout_height="@dimen/dropdownListPreferredItemHeight"
android:background="@color/marrom"
android:ellipsize="marquee"
android:gravity="center_vertical"
android:minHeight="@dimen/txt_min_height"
android:paddingEnd="@dimen/md_keylines"
android:paddingStart="@dimen/md_keylines"
android:singleLine="true"
android:textAllCaps="true"
android:textColor="@color/white"
android:textSize="@dimen/text_subtitle"
tools:text="spinner dropdown item" />
以及微调适配器中的
getDropdownView
:@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
T element = elements.get(position);
convertView = LayoutInflater.from(parent.getContext()).inflate(getDropdownLayout(), parent, false);
final TextView textView = (TextView) convertView;
textView.setText(getDisplayName(element));
return textView;
}
函数
getDropdownLayout
返回上面的布局 最佳答案
经过一番研究,我偶然发现了一个建议:spinner with a rectangular border。
创建9块图像(矩形框),可帮助您设置微调器的不同分辨率。
创建9个补丁图像后,将其用作微调框的背景。
这是使创建9pacth图像变得简单的链接:http://inloop.github.io/shadow4android/
这是我的示例: