后台禁用android:padding设置

后台禁用android:padding设置,第1张

概述我有一个ListView与自定义项目布局和自定义背景. 问题是 android:我从< shape>切换后台drawable后似乎忽略了padding值到< layer-list>. 布局/ list_item.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:i 我有一个ListVIEw与自定义项目布局和自定义背景.
问题是 android:我从< shape>切换后台drawable后似乎忽略了padding值到< @R_172_3419@>.

布局/ List_item.xml

<linearLayout    xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:ID="@+ID/layout_List_item_bill"    androID:orIEntation="vertical"    androID:layout_wIDth="match_parent"    androID:layout_height="wrap_content"    androID:padding="12dp">    . . .</linearLayout>

绘制/ List_item_background.xml

<shape    xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:shape="rectangle">        <solID androID:color="@color/white" />        <corners androID:radius="@dimen/corner_radius" />        <stroke androID:wIDth="1dp" androID:color="@color/blue" /></shape>

以上工作如预期.当我将drawable / List_item_background.xml更改为时,填充消失

<@R_172_3419@ xmlns:androID="http://schemas.androID.com/apk/res/androID">    <item>        <shape>            <solID androID:color="@color/white"/>        </shape>    </item>    <item>        <shape androID:shape="rectangle">            <solID androID:color="@color/white" />            <corners androID:radius="@dimen/corner_radius" />            <stroke androID:wIDth="1dp" androID:color="@color/blue" />        </shape>    </item></@R_172_3419@>

我错过了什么?

解决方法 包装<层列表>在< selector>中解决了这个问题:

<selector xmlns:androID="http://schemas.androID.com/apk/res/androID">    <item>        <@R_172_3419@>            <item>                <shape>                    <solID androID:color="@color/white"/>                </shape>            </item>            <item>                <shape androID:shape="rectangle">                    <solID androID:color="@color/white" />                    <corners androID:radius="@dimen/corner_radius" />                    <stroke androID:wIDth="1dp" androID:color="@color/blue" />                </shape>            </item>        </@R_172_3419@>    </item></selector>
总结

以上是内存溢出为你收集整理的后台禁用android:padding设置全部内容,希望文章能够帮你解决后台禁用android:padding设置所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1127683.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存