siberianowl
Lurker
I would like to show on screen a custom-drawing object and several 'normal' widgets. So I did a screen layout like this:
myView class is a direct descendant from a View. Also I want to add in run-time several Button widgets into my R.id.controlPanel.
In onCreate() of my activity I have a code like this:
The problem with the above code is that my custom drawing object takes all space on screen and all objects in controlPanel layout are somewhere below. I do not see nor design-time created TextView, nor run-time created buttons. I do not understand why is it so? I already set
android:layout_height="wrap_content"
for my myView object, why does it takes whole screen?
Any ideas would be appreciated.
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="[URL]http://schemas.android.com/apk/res/android[/URL]"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical">
<myView
android:layout_width="wrap_content"
android:id="@+id/blackboard"
android:layout_height="wrap_content"
android:layout_margin="2sp" android:clickable="true"></myView>
<LinearLayout android:layout_width="fill_parent"
android:orientation="horizontal"
android:id="@+id/contorlPanel"
android:layout_height="fill_parent">
<TextView android:text="TextView"
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
In onCreate() of my activity I have a code like this:
Code:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.boardScreen);
myView board = (myView)findViewById(R.id.blackBoard);
board.setDataSource( ... );
LinearLayout controlPanel = (LinearLayout)findViewById(R.id.contorlPanel);
Button btn = new Button(getApplicationContext());
btn.setText("new button");
controlPanel.addView(btn);
}
android:layout_height="wrap_content"
for my myView object, why does it takes whole screen?
Any ideas would be appreciated.