I am using Eclipse Indigo while testing 2 emulators (2.2 and 3.0).
The code below shows that I'm testing now, however setting the text size does not show anything on the screen when trying to start the emulator. (if I comment on the size of the text, the text is displayed in red). I thought somehow the eclipse did not rearrange the code, but I added a line of code to add a blue background, and that worked. I tried to set the size of the text after the text was still unsuccessful. code below. Thanks for your help! (disclaimer) - I try to stay away from xml. Being what I already know java, I don't want to depend on it.
import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.widget.TextView; public class TestAndroidvs2Activity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView text = new TextView(this); text.setTextColor(Color.RED); text.setTextSize(2); text.setBackgroundColor(Color.BLUE); text.setText("Hello Android"); setContentView(text); } }
android
cspam Aug 09 '11 at 15:43 2011-08-09 15:43
source share