2014-10-17 26 views
0

我有一个选择ExpandableListView,具有由Android资产工作室中创建的Drawable I定义的自定义复选框。自定义复选框会在isChecked为true时更改其大小Android?

由于某些原因,当复选框被选中时,它看起来比它没有时更小。我已经检查过,如果我在图像大小上犯了错误,它们都具有相同的大小。 (禁用或启用)。

这里是我的自定义复选框的代码:

绘制/ custom_checkbox.xml

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 

    <item android:drawable="@drawable/ic_success_enabled" android:state_checked="true" android:state_focused="true"/> 
    <item android:drawable="@drawable/ic_accept_disabled" android:state_checked="false" android:state_focused="true"/> 
    <item android:drawable="@drawable/ic_accept_disabled" android:state_checked="false"/> 
    <item android:drawable="@drawable/ic_success_enabled" android:state_checked="true"/> 

</selector> 

我绘制/ ic_success_enabled &残疾人是:

enabled

disabled

在ExpandableListView

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/RelativeLayout1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:padding="5dp" > 

    <TextView 
     android:id="@+id/title_one_item" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="false" 
     android:layout_centerVertical="true" 
     android:layout_toLeftOf="@+id/one_item_checkbox" 
     android:layout_toRightOf="@+id/one_item_row_image" 
     android:padding="10dp" 
     android:textAppearance="?android:attr/textAppearanceLarge" 
     android:textColor="@color/akdemia_0_black" /> 

    <com.akdemia.application.CircularImageView 
     android:id="@+id/one_item_row_image" 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:layout_alignParentLeft="false" 
     android:layout_alignParentTop="false" 
     android:layout_centerVertical="true" 
     android:src="@drawable/placeholder_icon_iphone" /> 

    <CheckBox 
     android:id="@+id/one_item_checkbox" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_centerVertical="true" 
     android:background="@drawable/akdemia_checkbox" 
     android:button="@null" 
     android:focusable="false" /> 

</RelativeLayout> 

在这里,每个元素的行是ExpandableListView的屏幕截图,在这里你们可以看到问题:(所有地方故意添加的橙色矩形,不理会他们)

screenshot

希望任何人都可以帮助我这个,在此先感谢!

回答

0

给你的复选框布局宽度和高度是这样的:

android:layout_width="25dp" 
android:layout_height="25dp" 
+0

吉兹...这是尴尬的,哈哈,没想到检查的宽度和高度。谢谢!这解决了这个问题。 – 2014-10-17 20:02:30

+0

没问题,它总是小事情;) – bbvanee 2014-10-17 20:03:46

相关问题