How can I attach 2 or more children (Views) to an Activity? I can't
seem to find a way to attach these CheckBoxes to the main Activity.
Only one of them gets rendered.
public class AddTwoViews extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LinearLayout layout = (LinearLayout) findViewById
(R.layout.main);
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
CheckBox alphaCheckBox = new CheckBox(this);
CheckBox redChannelCheckBox = new CheckBox(this);
setContentView(alphaCheckBox, p);
setContentView(redChannelCheckBox, p);
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---