2014-10-17 81 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