CheckBox with Background attribute renders incorrectly?

by Droidnostics » Tue, 06 Oct 2009 01:18:10 GMT


Sponsored Links
 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");

      }

}


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. opengl: gluProject() in GL10

Maybe pixelfinger is around for this one.

We need the projection and modeview matrices for the gluProject()
call, so to get them i understand we can use glGetFloatv() with
GL_MODELVIEW_MATRIX and GL_PROJECTION_MATRIX, or we can use
glGetIntegerv() with GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES and
GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES as noted in the GLU
documentation for gluProject(). But glGetFloatv() is GL11 and
currently unsupported, and GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES
is also GL11 and also unsupported. Is it possible to obtain the needed
matrices for gluProject() in the supported GL10?
thanks.
--~--~---------~--~----~------------~-------~--~----~

2. application freezing with Looper

hi all.

my android application freezes when using the Looper.prepare() ->
Looper.loop() -> Looper.myLooper().quit() sequence. here's the code
where it blocks:

public void endData() {
               String result = new String(baf.toByteArray());

               Looper.prepare();
               Toast.makeText(myActivity, result,
Toast.LENGTH_SHORT).show();
               Looper.loop();

               Looper.myLooper().quit();

}

any idea of what the problem might be?

thanks in advance,

pedro cristovo.
--~--~---------~--~----~------------~-------~--~----~

3. File Upload/Download -- Best practices...

4. Partial changes to the existing applications

5. New DroidDraw Release...

6. PLZ SEND A COMPLETE CODE OF VIDEO PLAYING

7. want to take the height and width of editText from String file