android - 自定义微调器上的小错误空间
问题描述
我只是将我的微调器自定义视图设置为下拉列表,它是支持的。但不知何故,“15”文本下方出现了一个小空间,因此它不会水平呈线性。
这是我的代码:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:textSize="18sp"
android:textStyle="bold"
android:textColor="@color/white"
android:textAlignment="center"
android:background="@drawable/timepickerbutton"
android:paddingEnd="20dp"
app:drawableEndCompat="@drawable/ic_arrow_down_sign_to_navigate" />
解决方案
尝试将 height 参数更改为 wrap_content 并将 width 更改为 fill_parent
我的一个项目中有下一个自定义微调器项目,他后面没有任何其他布局,只有纯 XML 文件和一个 TextView,它可以按预期工作:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/customSpinnerItemTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="5dip"
android:textColor="@color/vectorColor"
android:textSize="20sp"
tools:text="sometext" />
推荐阅读
- java - 如何编写多线程代码以加快繁重的重复性任务?
- haskell - 如何在以下示例代码的上下文中将函数输出显示为列表 [a] 而不是字符串显示 [a]
- git - git commit message 写下以下内容,添加'Merge'以及userstory&defect,如果输入merge,它不应该询问故事编号
- android - 应用因 branch.io 而从 Google Play 下架
- apache-spark - spark避免每次都构建RDD
- elasticsearch - 需要非嵌套格式的过滤聚合查询输出
- r - 将估计概率之和归一化为 1
- python - 如何使用列名格式化熊猫中的列
- python - pandas diff() 忽略 groupby
- php - Laravel 多语言无前缀路由