android - 如何隐藏 Button 和 TextView 的边框?
问题描述
我创建了用于输入数量的按钮,效果很好,但是 Button 和 TextView 周围有边框。这个边框怎么去掉?
<LinearLayout
android:layout_width="90dp"
android:layout_height="33dp"
android:layout_alignBottom="@+id/BasketGoodsIcon"
android:layout_marginStart="7dp"
android:layout_marginBottom="7dp"
android:layout_toEndOf="@+id/BasketGoodsIcon"
android:orientation="horizontal">
<Button
android:id="@+id/decrement"
android:layout_width="30dp"
android:layout_height="match_parent"
android:background="@drawable/button_left_round"
android:padding="0dp"
android:text="-"
android:textColor="@color/BasketInputQttyBtnTxtColor"
android:textStyle="bold" />
<TextView
android:id="@+id/display"
android:layout_width="30dp"
android:layout_height="match_parent"
android:background="@color/BasketInputQttyBtnColor"
android:gravity="center"
android:inputType="number"
android:text="1"
android:textColor="@android:color/black" />
<Button
android:id="@+id/increment"
android:layout_width="30dp"
android:layout_height="match_parent"
android:background="@drawable/button_right_round"
android:padding="0dp"
android:text="+"
android:textColor="@color/BasketInputQttyBtnTxtColor" />
</LinearLayout>
我希望这三个元素看起来像一个元素。
解决方案
在你的背景 drawable.xml 使边框颜色透明
<stroke
android:color="#0000" />
推荐阅读
- python - TensorFlow2.1.0 中图形可视化失败
- parameters - MapStruct 最佳实践 - 接口/抽象类中的 @Context 参数或字段?
- python - 我做了一个主菜单,但不知道如何让游戏开始
- python - 网页抓取:selenium.common.exceptions.ElementNotInteractableException:消息:元素不可交互
- android - 如何使用 Kotlin 中的 Room 使用实体中的另一个字段来更新 List 中的数据
- c# - 当值为 NULL 时不要创建 XElement
- python - 如何编写一个抓取多个网页的scrapy程序?
- php - 从字符串变量插入日期不起作用
- javascript - 如何提高在范围内查找完美数字的性能 [Java Script]
- c - 为什么 C puts 附加换行符而 fputs 没有?