2016-01-26 33 views
1

下面給出我的XML佈局使用AppCompatCheckBox,AppCompatCheck Box在Android 4.3的API 18

<android.support.v7.widget.AppCompatCheckBox 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="" 
     android:id="@+id/checkBox" 
     android:buttonTint="@color/appColor" 
     android:layout_centerVertical="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:layout_marginLeft="15dp" 
     android:layout_marginStart="15dp" /> 

但複選框不可見不是在設備上運行4.3可見。但CheckBox文本是可見的,但不是CheckBox。這裏有什麼問題?

我跟隨此link。用5分查看答案。

+0

這對'Lollipop' +'Kitkat 4.4.2'有效,你試過在另一個API上? – Mohsen

+0

是的,它適用於兩者。我試過了 – Zach

回答

0

我不知道這是否解決,但你不需要使用AppCompatCheckBox;一個簡單的CheckBox就足夠了。

您正在使用的活動(可能是AppCompatActivity)會自動將佈局複選框膨脹爲AppCompatCheckBox s。

AppCompat*小部件只能在運行時創建視圖時使用,例如, new AppCompatCheckBox(context)或子類。

相關問題