Code example for Switch

Methods: setText, setOnClickListener

0
    private Switch mSwitchView;
     
	private void initFragmentView(ViewGroup container) {
		//mStatusTextView = new TextView(getActivity()); 
		if(!isInitialized){
			mSwitchView=new Switch(getActivity());
		 
			mLinearLayout = new LinearLayout(getActivity());
			mLinearLayout.setOrientation(LinearLayout.VERTICAL);
			//mLinearLayout.addView(mStatusTextView); 
	        mLinearLayout.addView(mSwitchView);
		} 
 
        container.addView(mLinearLayout);
 
        //setupVisualizerFxAndUI(); 
        setupEqualizerFxAndUI(); 
 
        // Make sure the visualizer is enabled only when you actually want to receive data, and 
        // when it makes sense to receive data. 
        //mVisualizer.setEnabled(true); 
 
        //mStatusTextView.setText("Playing audio..."); 
        mSwitchView.setText("开启均衡器:");
        mSwitchView.setOnClickListener(new OnClickListener() {
			 
			@Override 
			public void onClick(View v) {
				if(mSwitchView.isChecked()){
					mSwitchView.setChecked(true);