Tuesday, June 26, 2012

How to use CheckTextView

If you want to implement the the one CheckTextView, how do we go about it? 
First of all to join in the XML inside a CheckTextView

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <CheckedTextView android:id="@+id/checkTextView01" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="aaaa" android:checkMark="?android:attr/listChoiceIndicatorMultiple" /> </LinearLayout> 



Note: be sure to add this line of Android: checkMark =? The android: attr / listChoiceIndicatorMultiple "will appear behind tick options and then in the JAVA file inside it called out to write the event 


 package com.givemepass.CheckedTextView; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.CheckedTextView; public class CheckedTextViewTestActivity extends Activity { /** Called when the activity is first created. */ private CheckedTextView myCheckTextView01; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); myCheckTextView01 = (CheckedTextView)findViewById(R.id.checkTextView01); myCheckTextView01.setChecked(true); myCheckTextView01.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { ((CheckedTextView) v).toggle(); } }); } } 


The toggle can make your component like a switch, opening and closing and then you can see the bottom of the diagram did not tick 


No comments:

Post a Comment