【问题标题】:Make Pointer Icon in expandable list Bold使可扩展列表中的指针图标变为粗体
【发布时间】:2018-03-30 14:21:15
【问题描述】:

我创建了一个可扩展列表并将指针图标作为箭头。有没有办法让这个图标变粗以使其脱颖而出?

这里的箭头不清楚,我想让它变暗

可扩展列表视图的 XML

<ExpandableListView
    android:id="@+id/expandable_list_view3"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="start"
    android:dividerHeight="3dp"
    android:pointerIcon="arrow"></ExpandableListView>

【问题讨论】:

    标签: android xml colors expandablelistview


    【解决方案1】:

    您可以根据需要定义指针图像,然后将其调用到ExpandableView。一个例子:

    <ExpandableListView
            android:id="@+id/expandable_list_view3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="start"
            android:dividerHeight="3dp"
            android:groupIndicator="@drawable/arrow" />
    

    现在定义arrow.xml

    <selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/up_arrow" 
         android:state_expanded="false" />
    <item android:drawable="@drawable/down_arrow" 
         android:state_expanded="true" />
    </selector>
    

    您必须为展开状态和收缩状态定义两个图像。 您也可以查看Reference Doc,您坚持使用PointerIcon。医生说:

    指针图标可以由系统使用系统类型提供,也可以由应用程序使用位图或应用程序资源提供。

    【讨论】:

    • 您的问题得到解答了吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多