Hello, I am trying to have the main screen displayed from within activity using setContentView(R.layout.main); and then have an image displayed as follows:
public class TryGraph extends Activity {
/** Called when the activity is first created. */
public LinearLayout mLinearLayout;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Create a LinearLayout in which to add the ImageView
mLinearLayout = new LinearLayout(this);
// Instantiate an ImageView and define its properties
ImageView i = new ImageView(this);
i.setImageResource(R.drawable.face3);
i.setAdjustViewBounds(true); // set the ImageView bounds to match the Drawable's dimensions
mLinearLayout.addView(i);
setContentView(mLinearLayout);
}
}
The main.xml is like this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<Button android:text="button" android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>
The button is hidden by the pic as it is drawn over top of button. How to place the pic on the fly at different place so that both the button and pic are displayed. note: I don't want to display pic from xml, I want to display it from LinearLayout.