I think with whatever you use, you are ataching a view to a layout and not to a point on the screen. You may have to look at the drawable class, and create an ovel but not a view.
-Kitzy On Mar 24, 1:01 am, Luca Bedogni <[email protected]> wrote: > I tried also with other layouts but the problem remains. I think I > have to change approach, but I don't know how. > The code isn't a problem, but I don't have it here but at home. > -- > Luca Bedogni > Freelance Web Developerhttp://www.lucabedogni.it > > > > On Wed, Mar 24, 2010 at 3:31 AM, murali raju <[email protected]> wrote: > > ya framelayout always places views on the left-top corner. Instead use any > > other layout like linear and add to it when ever a new view is created. I > > think if u can show your code the problem can be solved faster. > > > On Tue, Mar 23, 2010 at 1:05 PM, Luca <[email protected]> wrote: > > >> I think that the problem is that the FrameLayout accepts only one > >> image, and places the last one on the top of the others. > >> So I think I have to change approach, any hint? > > >> On 23 Mar, 08:22, Luca Bedogni <[email protected]> wrote: > >> > Doesn't work, I have the view that now is 30x30 pixels, but on the top > >> > left of the screen and my drawable gets cutted off. > >> > -- > >> > Luca Bedogni > >> > Freelance Web Developerhttp://www.lucabedogni.it > > >> > On Tue, Mar 23, 2010 at 3:11 AM, murali raju <[email protected]> > >> > wrote: > >> > > use h.setLayoutParams(new ViewGroup.LayoutParams( > >> > > 30,30)); > > >> > > On Mon, Mar 22, 2010 at 11:49 AM, Luca Bedogni > >> > > <[email protected]> > >> > > wrote: > > >> > >> Mmm, I investigated a bit and i think this is not the problem. I'm > >> > >> making a new object every time. > >> > >> Beside that, I noticed that the view added has the dimensions of the > >> > >> screen, and not 30 pixels as I want. How can I avoid that? > > >> > >> Thanks > >> > >> -- > >> > >> Luca Bedogni > >> > >> Freelance Web Developer > >> > >>http://www.lucabedogni.it > > >> > >> On Mon, Mar 22, 2010 at 4:04 AM, murali raju <[email protected]> > >> > >> wrote: > >> > >> > coz you are using the same view object to all the shapes. so only > >> > >> > the > >> > >> > most > >> > >> > recently created view will have listener. use an arraylist and add > >> > >> > the > >> > >> > view > >> > >> > to it when ever a shape is created. > >> > >> > and check which view is clicked by using view.isPressed(). > > >> > >> > On Sun, Mar 21, 2010 at 1:26 AM, Luca Bedogni > >> > >> > <[email protected]> > >> > >> > wrote: > > >> > >> >> Hi > >> > >> >> I have the following code: > > >> > >> >> int x = (int)Math.round(Math.random()*200); > >> > >> >> int y = (int)Math.round(Math.random()*300); > > >> > >> >> View h = new CustomDrawableView(c,x,y); > >> > >> >> h.setLayoutParams(new ViewGroup.LayoutParams( > >> > >> >> ViewGroup.LayoutParams.WRAP_CONTENT, > >> > >> >> ViewGroup.LayoutParams.WRAP_CONTENT)); > > >> > >> >> h.setOnClickListener(new OnClickListener() { > > >> > >> >> �...@override > >> > >> >> public void onClick(View v) { > >> > >> >> // TODO Auto-generated > >> > >> >> method > >> > >> >> stub > >> > >> >> Log.d("VIEW",v.toString()); > > >> > >> >> v.setVisibility(View.INVISIBLE); > >> > >> >> } > > >> > >> >> }); > > >> > >> >> inside an Handler, that create every 2 seconds a new ovalShape and > >> > >> >> add > >> > >> >> it to the Layout. > >> > >> >> Everything works fine, except for the clickListener. In fact, when > >> > >> >> i > >> > >> >> press one of my shapes on the screen, it will be made invisible > >> > >> >> only > >> > >> >> the last one, and not what I clicked. > > >> > >> >> Am I missing something? > >> > >> >> -- > >> > >> >> Luca Bedogni > >> > >> >> Freelance Web Developer > >> > >> >>http://www.lucabedogni.it > > >> > >> >> -- > >> > >> >> You received this message because you are subscribed to the Google > >> > >> >> Groups "Android Beginners" group. > > >> > >> >> NEW! Try asking and tagging your question on Stack Overflow at > >> > >> >>http://stackoverflow.com/questions/tagged/android > > >> > >> >> To unsubscribe from this group, send email to > >> > >> >> [email protected] > >> > >> >> For more options, visit this group at > >> > >> >>http://groups.google.com/group/android-beginners?hl=en > > >> > >> >> To unsubscribe from this group, send email to > >> > >> >> android-beginners+unsubscribegooglegroups.com or reply to this > >> > >> >> email > >> > >> >> with > >> > >> >> the words "REMOVE ME" as the subject. > > >> > >> > -- > >> > >> > You received this message because you are subscribed to the Google > >> > >> > Groups "Android Beginners" group. > > >> > >> > NEW! Try asking and tagging your question on Stack Overflow at > >> > >> >http://stackoverflow.com/questions/tagged/android > > >> > >> > To unsubscribe from this group, send email to > >> > >> > [email protected] > >> > >> > For more options, visit this group at > >> > >> >http://groups.google.com/group/android-beginners?hl=en > > >> > >> > To unsubscribe from this group, send email to > >> > >> > android-beginners+unsubscribegooglegroups.com or reply to this > >> > >> > email > >> > >> > with > >> > >> > the words "REMOVE ME" as the subject. > > >> > >> -- > >> > >> You received this message because you are subscribed to the Google > >> > >> Groups "Android Beginners" group. > > >> > >> NEW! Try asking and tagging your question on Stack Overflow at > >> > >>http://stackoverflow.com/questions/tagged/android > > >> > >> To unsubscribe from this group, send email to > >> > >> [email protected] > >> > >> For more options, visit this group at > >> > >>http://groups.google.com/group/android-beginners?hl=en > > >> > >> To unsubscribe from this group, send email to > >> > >> android-beginners+unsubscribegooglegroups.com or reply to this email > >> > >> with > >> > >> the words "REMOVE ME" as the subject. > > >> > > -- > >> > > You received this message because you are subscribed to the Google > >> > > Groups "Android Beginners" group. > > >> > > NEW! Try asking and tagging your question on Stack Overflow at > >> > >http://stackoverflow.com/questions/tagged/android > > >> > > To unsubscribe from this group, send email to > >> > > [email protected] > >> > > For more options, visit this group at > >> > >http://groups.google.com/group/android-beginners?hl=en > > >> > > To unsubscribe from this group, send email to > >> > > android-beginners+unsubscribegooglegroups.com or reply to this email > >> > > with > >> > > the words "REMOVE ME" as the subject. > > >> -- > >> You received this message because you are subscribed to the Google > >> Groups "Android Beginners" group. > > >> NEW! Try asking and tagging your question on Stack Overflow at > >>http://stackoverflow.com/questions/tagged/android > > >> To unsubscribe from this group, send email to > >> [email protected] > >> For more options, visit this group at > >>http://groups.google.com/group/android-beginners?hl=en > > >> To unsubscribe from this group, send email to > >> android-beginners+unsubscribegooglegroups.com or reply to this email with > >> the words "REMOVE ME" as the subject. > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Beginners" group. > > > NEW! Try asking and tagging your question on Stack Overflow at > >http://stackoverflow.com/questions/tagged/android > > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > >http://groups.google.com/group/android-beginners?hl=en > > > To unsubscribe from this group, send email to > > android-beginners+unsubscribegooglegroups.com or reply to this email with > > the words "REMOVE ME" as the subject. -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en To unsubscribe from this group, send email to android-beginners+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

