Hi, I trying to implement a image as background and put images on top of it. this is my layout. Code:
<FrameLayout android:id="@+id/my_ph" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageView android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/sketch" /> </FrameLayout> and my class Code: import android.app.Activity; import android.os.Bundle; import android.view.View.OnClickListener; import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.Toast; public class myActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); FrameLayout rv =(FrameLayout)findViewById(R.id.my_ph); ImageButton im1 = new ImageButton(this); im1.setBackgroundResource(R.drawable.lamp_off_x); im1.setMinimumHeight(50); im1.setMinimumWidth(50); im1.setOnClickListener(OnLampClickListener()); im1.layout(50,50, 0, 0); rv.addView(im1); } OnClickListener OnLampClickListener(){ Toast.makeText(getBaseContext(), "Lamp",Toast.LENGTH_LONG); return null; } } my questions: 1. how to put the images im1 in specific place(x,y) on top of my ImageView. 2. how to implement the click event on the image im1 (i will have more images like that) 3. if i will dynamic load images on my ImageView how to know which image i clicked (where and how to save the image id that came from db). -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en