[android-developers] Re: Image Button Onclik view
Hi kholif, u can use ImageView.setOnclickListener(new setOnclick(){ Onclick(view){ /// user hide/display code here } } Moktarul On Feb 21, 5:33 pm, kholif adig adig...@gmail.com wrote: hi I have some problems in image button I have some image button that when clicked on the button will display the same image. the problem is if the image double click the botton on the button will display the same image on the first and second positions. please give me a solution thank you -- 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
[android-developers] Re: Image Button Onclik view
Hi kholif, in xml file for imageview add this one android:onclick=imageBtnClicked and in corresponding java file add this method: public void imageBtnClicked(View v) { // add your code here } On Feb 22, 1:58 pm, moktarul anam mokta...@gmail.com wrote: Hi kholif, u can use ImageView.setOnclickListener(new setOnclick(){ Onclick(view){ /// user hide/display code here } } Moktarul On Feb 21, 5:33 pm, kholif adig adig...@gmail.com wrote: hi I have some problems in image button I have some image button that when clicked on the button will display the same image. the problem is if the image double click the botton on the button will display the same image on the first and second positions. please give me a solution thank you -- 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
[android-developers] Re: Image Button Onclik view
Hi. . thanks for all the solutions. . :D On 22 Feb, 16:07, Seshu s.seshu...@gmail.com wrote: Hi kholif, in xml file for imageview add this one android:onclick=imageBtnClicked and in corresponding java file add this method: public void imageBtnClicked(View v) { // add your code here } On Feb 22, 1:58 pm, moktarul anam mokta...@gmail.com wrote: Hi kholif, u can use ImageView.setOnclickListener(new setOnclick(){ Onclick(view){ /// user hide/display code here } } Moktarul On Feb 21, 5:33 pm, kholif adig adig...@gmail.com wrote: hi I have some problems in image button I have some image button that when clicked on the button will display the same image. the problem is if the image double click the botton on the button will display the same image on the first and second positions. please give me a solution thank you -- 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
[android-developers] Re: Image Button Onclik view
hi I'll send an email to you and I will include pictures that can explain the intent of my question. . hopefully help thank you On 22 Feb, 06:17, TreKing treking...@gmail.com wrote: On Tue, Feb 21, 2012 at 6:33 AM, kholif adig adig...@gmail.com wrote: please give me a solution Please give a better question. What you posted is very confusing and makes little sense (at least to me). --- -- TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
Re: [android-developers] Re: Image Button Onclik view
On Tue, Feb 21, 2012 at 8:00 PM, adig adig...@gmail.com wrote: I'll send an email to you Uh, no. Please reply to this thread and the whole group. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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
[android-developers] Re: Image button Issue
Dear fei ji : Thanks for your kindly response. I had tried to use dip instead of px, but it doesm't work. Should I add anything except dip? BR, Mark On Feb 10, 7:31 pm, fei ji ufo22940...@gmail.com wrote: Did you use dip when setting height and width of ImageButton? On Fri, Feb 10, 2012 at 7:19 PM, mark2011 androidmark2...@gmail.com wrote: Dear All : I set up the background image, it will automatically adjust to match the diffent screens of different devices. But the image set for the button is not. Is there any method that I don't need to adjust the position of the ImageButton to match the different devices? Thanks in advanced. BR, Mark -- 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- Hide quoted text - - Show quoted text - -- 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
[android-developers] Re: Image Button?
Is there a way to have the selector code for multiple ImageButtons in one xml file. So, if i have 10 buttons, i want to have all the code in one file and not in 10 xml files to set the background for each button. Is there a way to give each selector tag an ID? and then use different selectors for different buttons but have them all together in one location? Kavik --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Image Button?
Hey Chris, I didn't realize this was done with the image background attribute, I guess sometimes the answer is that simple. Thanks for the heads-up and the code example. I am going to try this out, I will repost my findings... Thanks again, Kevin On Aug 20, 12:07 pm, Chris Chiappone [EMAIL PROTECTED] wrote: Not sure if this is the best way but it seems to work fine for what you want to do. I basically set the Button background image in the layout XML first. Then set up custom listeners (touch, click, onFocus) that call the following method that replaces the background image with another background image public void setBackgroundCellResource(View view, String position, boolean selected){ if(position.equals(POSITION_TOP)){ if(selected){ view.setBackgroundResource(R.drawable.btn_52_top_dn); }else{ view.setBackgroundResource(R.drawable.btn_52_top_up); } }else if(position.equals(POSITION_BOT)){ if(selected){ view.setBackgroundResource(R.drawable.btn_52_bot_dn); }else{ view.setBackgroundResource(R.drawable.btn_52_bot_up); } }else if(position.equals(POSITION_MID)){ if(selected){ //view.setBackgroundResource(R.drawable.btn_52_middle_dn); }else{ view.setBackgroundResource(R.drawable.btn_52_middle_up); } }else{ if(selected){ view.setBackgroundResource(R.drawable.btn_single_dn); }else{ view.setBackgroundResource(R.drawable.btn_single_up); } } } Hope that helps, ~chris On Wed, Aug 20, 2008 at 5:21 AM, cyntacks [EMAIL PROTECTED] wrote: I know a similar question has been asked before, specifically regarding the m5 sdk, but here it goes for the .9 release. I noticed that the new gui (which is awesome by the way) shows the icons on the home screen with no background, but they act like ImageButons in that when you click them the background lights up yellow. Is there a way to replicate this behavior in our applications? Currently all of my image buttons have the default button border (i.e. a big white margin around the image). I've searched through the new sdk's codebase but can't seem to figure out how this was done. As always, any help would be appreciated. Kevin -- ~chris --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Image Button?
This can actually all be done in XML. Just make a drawable that is a selector of the desired images. For example, here is the standard button background drawable: ?xml version=1.0 encoding=utf-8? !-- Copyright (C) 2008 Google Inc. Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -- selector xmlns:android=http://schemas.android.com/apk/res/android; item android:state_window_focused=false android:state_enabled=true android:drawable=@drawable/btn_default_normal / item android:state_window_focused=false android:state_enabled=false android:drawable=@drawable/btn_default_normal_disable / item android:state_pressed=true android:drawable=@drawable/btn_default_pressed / item android:state_focused=true android:state_enabled=true android:drawable=@drawable/btn_default_selected / item android:state_enabled=true android:drawable=@drawable/btn_default_normal / item android:state_focused=true android:drawable=@drawable/ btn_default_normal_disable_focused / item android:drawable=@drawable/btn_default_normal_disable / /selector On Aug 20, 9:07 am, Chris Chiappone [EMAIL PROTECTED] wrote: Not sure if this is the best way but it seems to work fine for what you want to do. I basically set the Button background image in the layout XML first. Then set up custom listeners (touch, click, onFocus) that call the following method that replaces the background image with another background image public void setBackgroundCellResource(View view, String position, boolean selected){ if(position.equals(POSITION_TOP)){ if(selected){ view.setBackgroundResource(R.drawable.btn_52_top_dn); }else{ view.setBackgroundResource(R.drawable.btn_52_top_up); } }else if(position.equals(POSITION_BOT)){ if(selected){ view.setBackgroundResource(R.drawable.btn_52_bot_dn); }else{ view.setBackgroundResource(R.drawable.btn_52_bot_up); } }else if(position.equals(POSITION_MID)){ if(selected){ //view.setBackgroundResource(R.drawable.btn_52_middle_dn); }else{ view.setBackgroundResource(R.drawable.btn_52_middle_up); } }else{ if(selected){ view.setBackgroundResource(R.drawable.btn_single_dn); }else{ view.setBackgroundResource(R.drawable.btn_single_up); } } } Hope that helps, ~chris On Wed, Aug 20, 2008 at 5:21 AM, cyntacks [EMAIL PROTECTED] wrote: I know a similar question has been asked before, specifically regarding the m5 sdk, but here it goes for the .9 release. I noticed that the new gui (which is awesome by the way) shows the icons on the home screen with no background, but they act like ImageButons in that when you click them the background lights up yellow. Is there a way to replicate this behavior in our applications? Currently all of my image buttons have the default button border (i.e. a big white margin around the image). I've searched through the new sdk's codebase but can't seem to figure out how this was done. As always, any help would be appreciated. Kevin -- ~chris --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Image Button?
Hi Hackbod, Thanks for that. Sometimes I make this stuff seem harder than it is! I think XML is the way to go, coming from a J2EE background I like the MVC style a bit better. But either way works, thanks again to both of you. Kevin On Aug 20, 6:44 pm, hackbod [EMAIL PROTECTED] wrote: This can actually all be done in XML. Just make a drawable that is a selector of the desired images. For example, here is the standard button background drawable: ?xml version=1.0 encoding=utf-8? !-- Copyright (C) 2008 Google Inc. Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -- selector xmlns:android=http://schemas.android.com/apk/res/android; item android:state_window_focused=false android:state_enabled=true android:drawable=@drawable/btn_default_normal / item android:state_window_focused=false android:state_enabled=false android:drawable=@drawable/btn_default_normal_disable / item android:state_pressed=true android:drawable=@drawable/btn_default_pressed / item android:state_focused=true android:state_enabled=true android:drawable=@drawable/btn_default_selected / item android:state_enabled=true android:drawable=@drawable/btn_default_normal / item android:state_focused=true android:drawable=@drawable/ btn_default_normal_disable_focused / item android:drawable=@drawable/btn_default_normal_disable / /selector On Aug 20, 9:07 am, Chris Chiappone [EMAIL PROTECTED] wrote: Not sure if this is the best way but it seems to work fine for what you want to do. I basically set the Button background image in the layout XML first. Then set up custom listeners (touch, click, onFocus) that call the following method that replaces the background image with another background image public void setBackgroundCellResource(View view, String position, boolean selected){ if(position.equals(POSITION_TOP)){ if(selected){ view.setBackgroundResource(R.drawable.btn_52_top_dn); }else{ view.setBackgroundResource(R.drawable.btn_52_top_up); } }else if(position.equals(POSITION_BOT)){ if(selected){ view.setBackgroundResource(R.drawable.btn_52_bot_dn); }else{ view.setBackgroundResource(R.drawable.btn_52_bot_up); } }else if(position.equals(POSITION_MID)){ if(selected){ //view.setBackgroundResource(R.drawable.btn_52_middle_dn); }else{ view.setBackgroundResource(R.drawable.btn_52_middle_up); } }else{ if(selected){ view.setBackgroundResource(R.drawable.btn_single_dn); }else{ view.setBackgroundResource(R.drawable.btn_single_up); } } } Hope that helps, ~chris On Wed, Aug 20, 2008 at 5:21 AM, cyntacks [EMAIL PROTECTED] wrote: I know a similar question has been asked before, specifically regarding the m5 sdk, but here it goes for the .9 release. I noticed that the new gui (which is awesome by the way) shows the icons on the home screen with no background, but they act like ImageButons in that when you click them the background lights up yellow. Is there a way to replicate this behavior in our applications? Currently all of my image buttons have the default button border (i.e. a big white margin around the image). I've searched through the new sdk's codebase but can't seem to figure out how this was done. As always, any help would be appreciated. Kevin -- ~chris --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] Announcing the new Android 0.9 SDK beta! http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---