2014-09-19 8 views
7

में टेक्स्ट नहीं है, मैं केवल चेकबॉक्स बॉक्स को कैसे छुपा सकता हूं, लेकिन चेकबॉक्स टेक्स्ट में नहीं। Checkbox प्रोग्रामेटिक रूप से बनाया गया है।केवल चेकबॉक्स बॉक्स को छुपाएं, यह एंड्रॉइड

myCheckBox.setVisibility(View.GONE) टेक्स्ट के साथ पूरे चेकबॉक्स को भी छुपाता है। मैं केवल टेक्स्ट दिखाना चाहता हूं लेकिन बॉक्स आइकन नहीं।

जल्द ही आपसे सुनने के लिए तत्पर हैं।

उत्तर

0

आप ऐसा कर सकते हैं, चेकबॉक्स तत्व में टेक्स्ट मान न दें, आप पाठ के लिए अलग-अलग टेक्स्टव्यू का उपयोग करें और चेकबॉक्स छुपाएं। उदाहरण

  <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Hindustan"/> 
     <CheckBox 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:visibility="invisible" 
      android:id="@+id/hindustanCB"/> 
+0

नहीं एक अच्छा दृष्टिकोण। – Killer

7

यह मेरे लिए काम करता है:

Drawable transparentDrawable = new ColorDrawable(Color.TRANSPARENT); 
myCheckBox.setButtonDrawable(transparentDrawable); 
संबंधित मुद्दे