我怎么能在android中制作这样的自定义视图

问题描述 投票:0回答:2

必需的自定义视图 Required Custom view 您好,我正在尝试设计如上所述的自定义tablayout。我尝试过使用带有三面边框的自定义视图,但这并不完全像上面的图像。任何人都可以帮忙,请...

到目前为止,我已经完成了如下图像,但这并不像预期的那样。

my custom view

android android-custom-view android-tablayout
2个回答
0
投票

在style.xml中为您的选项卡创建一个新样式,并添加如下

   <style name="MyCustomTabLayout" parent="Widget.Design.TabLayout">
        <item name="tabIndicatorColor">@android:color/white</item>
   <item name="tabBackground">@android:color/white</item>
</style>

并将此样式应用于TabLayout将解决您的问题


0
投票

只是为了记录,我使用recyclerview而不是tablayout完成了这个。使用recyclerview viewholder的自定义视图给了我更多的灵活性。如果有人有更好的解决方案,请随时通知我。

© www.soinside.com 2019 - 2024. All rights reserved.