Beginners question: why does the CheckBox render the text (when setText is
invoked) behind the checkbox (instead of next to the checkbox) when an
background image is assigned?

Second question: how do I make it *not* render behind the checkbox (and
still use a background image)?

 

Layout code:

<?xml version="1.0" encoding="utf-8"?>

<CheckBox xmlns:android="http://schemas.android.com/apk/res/android";

      android:id="@+id/check"

      android:layout_width="wrap_content"

      android:layout_height="wrap_content"

      android:text="This checkbox is: unchecked"

      android:background="@drawable/icon"

       />

 

 

Main class

import android.app.Activity;

import android.os.Bundle;

import android.widget.CheckBox;

import android.widget.CompoundButton;

import android.widget.CompoundButton.OnCheckedChangeListener;

 

public class TestCheckBox extends Activity implements
OnCheckedChangeListener 

{

      CheckBox m_checkBox;

      

    /** Called when the activity is first created. */

    @Override

    public void onCreate(Bundle savedInstanceState) 

    {

        super.onCreate(savedInstanceState); 

        setContentView(R.layout.main);

        

        m_checkBox = (CheckBox)findViewById(R.id.check);

     

        m_checkBox.setOnCheckedChangeListener(this);

    }

 

      public void onCheckedChanged(CompoundButton buttonView, boolean
isChecked) 

      {

            if (isChecked)

                  m_checkBox.setText("Checkbox is checked");

            else

                  m_checkBox.setText("Checkbox is unchecked");

      }

}


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to