android,checkedTextView:不同宽度的复选标记

android,checkedTextView:不同宽度的复选标记,android,checkedtextview,Android,Checkedtextview,我已选中TextView选择器: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/checkbox_checked" android:state_checked="true"/> <item android:drawable="@drawable/checkbox_unchecked" android:st

我已选中TextView选择器:

<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/checkbox_checked" android:state_checked="true"/>
<item android:drawable="@drawable/checkbox_unchecked" android:state_checked="false"/>

</selector>

当我在另一个下面有两个这样的选中文本视图时,第一个是未选中的,另一个是选中的,看起来如下所示:

您可以注意到,与选中状态相比,处于未选中状态的边框更宽。根据我的参考资料,这些边框的宽度相同,但选中的资源更宽,因为绘制橙色复选标记需要额外的像素

如何使边界看起来相同?有没有比使用RelativeLayout+TextView+复选框更有效的方法


更新1,布局:

    <CheckedTextView
        android:id="@+id/saveVideoOnServer"
        style="@style/talCell.textView.checked"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/saveVideoOnServer" />
        android:background="@android:color/transparent"

    <CheckedTextView
        android:id="@+id/showMyPosition"
        style="@style/talCell.textView.checked"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:checked="true"
        android:text="@string/showMyPosition" />

android:background=“@android:color/transparent”

它们位于垂直线性布局内。我没有发布整个布局,因为它有100多行。

您需要使两个图像的宽度相同。在你提到的问题中,边界是相同的宽度。如果您现在只是通过添加透明像素使未选中的图像变宽,那么一切都应该正常

总而言之:您需要两个大小相同、边界大小和位置相同的图像

Android源代码也一样,请看下面两个复选框图像:它们的大小相同(在github站点上更容易看到:,)


您可以发布布局文件吗(使用
复选框
)?这是九张补丁图片吗?添加了。这些是常见的PNG,而不是9-patch。