顶部有边框的 Android TabLayout [英] Android TabLayout With Border On Top
本文介绍了顶部有边框的 Android TabLayout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我阅读了有关 TabLayout
的文档以添加属性以在 TabLayout
顶部制作边框,但我没有在文档中的任何地方找到它.
I read documentation about TabLayout
for add property to make border on top of TabLayout
but I didn't find it anywhere in documentation.
所以我想要一些技巧让 TabLayout
在顶部(或者底部)有边框.
So I want some trick to make TabLayout
have border on top (or maybe at bottom).
推荐答案
用这个 drawable xml 解决了:
Solved with this drawable xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<stroke
android:width="1dp"
android:color="#FFDDDDDD" />
<solid android:color="#FFFFFFFF" />
</shape>
</item>
<item
android:top="1dp">
<shape android:shape="rectangle">
<stroke
android:width="1dp"
android:color="#FFFFFFFF" />
<solid android:color="#00000000" />
</shape>
</item>
</layer-list>
并设置为tablayout属性/属性:
and set into tablayout attribute/property:
android:background="@drawable/drawableName"
这篇关于顶部有边框的 Android TabLayout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文