【问题标题】:Change bottom border color when selected a listview item选择列表视图项时更改底部边框颜色
【发布时间】:2016-07-13 11:51:47
【问题描述】:

此屏幕截图来自我的短信应用程序。我只是想知道,是否可以将蓝色边框颜色更改为橙​​色以匹配我的应用程序主题?

我尝试了很多东西,但都没有奏效。我知道在样式 xml 文件中可能要写一些东西,但我能做什么?有人有想法吗?

请指导我。

【问题讨论】:

    标签: android listview colors border


    【解决方案1】:

    检查此回购:link

    这是一个关于标签及其颜色的 xml sn-p。

    另外,如果您需要所选项目的边框颜色,您应该试试这个:

    用它作为你的物品的边框

    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:padding="8dp"
        android:shape="rectangle" >
    
        <solid android:color="@android:color/transparent" />
    
        <stroke
            android:width="1px"
            android:color="#yourcolorhere" />
    
        <corners
            android:bottomLeftRadius="1dp"
            android:bottomRightRadius="1dp"
            android:topLeftRadius="0dp"
            android:topRightRadius="0dp" />
    
    </shape>
    

    这适用于可绘制文件夹中的选择器:

        <?xml version="1.0" encoding="utf-8"?>
            <selector xmlns:android="http://schemas.android.com/apk/res/android">
                <item android:drawable="@drawable/myBorder"          
    android:state_selected="true"> <!--you can change this to android:state_pressed not selected if you're using RelativeLayout -->
        </item>
                <item android:drawable="@android:color/transparent"></item>
            </selector>
    

    【讨论】:

    • 我只想将蓝色边框颜色更改为橙​​色。您提供的代码不会更改它,因为当用户长按列表项时会出现此边框。这种情况该怎么办?
    • 让我检查一下,谢谢先生
    猜你喜欢
    • 2017-03-06
    • 1970-01-01
    • 2015-01-13
    • 2014-09-16
    • 1970-01-01
    • 2018-04-12
    • 1970-01-01
    • 2012-08-08
    • 1970-01-01
    相关资源
    最近更新 更多