[android-developers] Re: R.drawable.list_selector_background doesn't yield in orange
Dianne, thanks for the details. Seems like the only option I've got is finding list_selector_background in the sources and seeing if I can create a similar drawable that won't depend on focus state. On May 7, 12:47 am, Dianne Hackborn hack...@android.com wrote: View takes care of updating the drawable state as appropriate. There are methods on view you can override what it sets, but I don't think there is any API you can call to just force it to something. On Wed, May 6, 2009 at 2:04 PM, alex gsm...@gmail.com wrote: Ok, from pure conceptual point that IS selection. Anyways, don't think it's related to my initial question here. On May 6, 11:33 pm, Romain Guy romain...@google.com wrote: If you are using this drawable for something else than indicating a selection, I totally disagree. On Wed, May 6, 2009 at 1:30 PM, alex gsm...@gmail.com wrote: Sure. But in my particular case I think setting the background to standard orange is better than introducing a custom color/drawable. On May 6, 9:53 pm, Romain Guy romain...@google.com wrote: Taps should always cause focus and selection to disappear,. On Wed, May 6, 2009 at 11:49 AM, Jeff Sharkey jshar...@android.com wrote: When user selects a TextView it 'slips' (which is indicated by background color change) and the user is expected to select(tap) another view then. Not every tap should lead to the first view losing 'focus'. That's the motivation behind setting background drawable programmatically. Ouch, this is actually more of a touch mode question. When the device goes into touch mode, there isn't a visible concept of focus in ListViews (when you scroll the list, any highlighted item reverts back). You might be looking for android:focusableInTouchMode, but this isn't used many places on the platform. -- Jeff Sharkey jshar...@google.com -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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: R.drawable.list_selector_background doesn't yield in orange
Ended up grabbing the nine-patch image (which is list_selector_background_focus.9.png) and adding it to my own drawables. Not the approach I'd be proud of, but it works. On May 7, 2:07 pm, alex gsm...@gmail.com wrote: Dianne, thanks for the details. Seems like the only option I've got is finding list_selector_background in the sources and seeing if I can create a similar drawable that won't depend on focus state. On May 7, 12:47 am, Dianne Hackborn hack...@android.com wrote: View takes care of updating the drawable state as appropriate. There are methods on view you can override what it sets, but I don't think there is any API you can call to just force it to something. On Wed, May 6, 2009 at 2:04 PM, alex gsm...@gmail.com wrote: Ok, from pure conceptual point that IS selection. Anyways, don't think it's related to my initial question here. On May 6, 11:33 pm, Romain Guy romain...@google.com wrote: If you are using this drawable for something else than indicating a selection, I totally disagree. On Wed, May 6, 2009 at 1:30 PM, alex gsm...@gmail.com wrote: Sure. But in my particular case I think setting the background to standard orange is better than introducing a custom color/drawable. On May 6, 9:53 pm, Romain Guy romain...@google.com wrote: Taps should always cause focus and selection to disappear,. On Wed, May 6, 2009 at 11:49 AM, Jeff Sharkey jshar...@android.com wrote: When user selects a TextView it 'slips' (which is indicated by background color change) and the user is expected to select(tap) another view then. Not every tap should lead to the first view losing 'focus'. That's the motivation behind setting background drawable programmatically. Ouch, this is actually more of a touch mode question. When the device goes into touch mode, there isn't a visible concept of focus in ListViews (when you scroll the list, any highlighted item reverts back). You might be looking for android:focusableInTouchMode, but this isn't used many places on the platform. -- Jeff Sharkey jshar...@google.com -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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: R.drawable.list_selector_background doesn't yield in orange
So the list_selector_drawable is a stateful drawable, where it's default state is black. (This is why ListView unselected items are transparent/black.) The default button drawable is also stateful, but it's default state is an unpressed button. You could force it into a focused state using Drawable.setState() before setting it to the background. However, keep in mind that you probably don't want to have the TextView always appear selected, as it might confuse users to see two selected areas on screen at once. You might instead try setting the TextView to be focusable, so the background changes automatically whenever the user moves focus to the TextView. j On Wed, May 6, 2009 at 5:57 AM, gsmd gsm...@gmail.com wrote: Ok, here's a simple 'helloorange' activity: -- �...@override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText(some text); tv.setBackgroundDrawable(getResources().getDrawable (android.R.drawable.list_selector_background)); setContentView(tv); } -- When running this, the background doesn't change it's color. When I change to android.R.drawable.btn_default, it works. So, how do I apply orange background drawable to a TextView at runtime? TIA. -- Jeff Sharkey jshar...@google.com --~--~-~--~~~---~--~~ 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: R.drawable.list_selector_background doesn't yield in orange
It's default state is transparent actually :) On Wed, May 6, 2009 at 9:10 AM, Jeff Sharkey jshar...@android.com wrote: So the list_selector_drawable is a stateful drawable, where it's default state is black. (This is why ListView unselected items are transparent/black.) The default button drawable is also stateful, but it's default state is an unpressed button. You could force it into a focused state using Drawable.setState() before setting it to the background. However, keep in mind that you probably don't want to have the TextView always appear selected, as it might confuse users to see two selected areas on screen at once. You might instead try setting the TextView to be focusable, so the background changes automatically whenever the user moves focus to the TextView. j On Wed, May 6, 2009 at 5:57 AM, gsmd gsm...@gmail.com wrote: Ok, here's a simple 'helloorange' activity: -- �...@override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText(some text); tv.setBackgroundDrawable(getResources().getDrawable (android.R.drawable.list_selector_background)); setContentView(tv); } -- When running this, the background doesn't change it's color. When I change to android.R.drawable.btn_default, it works. So, how do I apply orange background drawable to a TextView at runtime? TIA. -- Jeff Sharkey jshar...@google.com -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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: R.drawable.list_selector_background doesn't yield in orange
Thanks, Jeff. When user selects a TextView it 'slips' (which is indicated by background color change) and the user is expected to select(tap) another view then. Not every tap should lead to the first view losing 'focus'. That's the motivation behind setting background drawable programmatically. Back to the question. -- Drawable bg = getResources().getDrawable (android.R.drawable.list_selector_background); bg.setState(new int[]{android.R.attr.state_pressed, android.R.attr.state_focused}); tv.setBackgroundDrawable(bg); -- This (and any of those attributes set alone) doesn't change anything. Do I still get it wrong? On May 6, 7:10 pm, Jeff Sharkey jshar...@android.com wrote: So the list_selector_drawable is a stateful drawable, where it's default state is black. (This is why ListView unselected items are transparent/black.) The default button drawable is also stateful, but it's default state is an unpressed button. You could force it into a focused state using Drawable.setState() before setting it to the background. However, keep in mind that you probably don't want to have the TextView always appear selected, as it might confuse users to see two selected areas on screen at once. You might instead try setting the TextView to be focusable, so the background changes automatically whenever the user moves focus to the TextView. j On Wed, May 6, 2009 at 5:57 AM, gsmd gsm...@gmail.com wrote: Ok, here's a simple 'helloorange' activity: -- �...@override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText(some text); tv.setBackgroundDrawable(getResources().getDrawable (android.R.drawable.list_selector_background)); setContentView(tv); } -- When running this, the background doesn't change it's color. When I change to android.R.drawable.btn_default, it works. So, how do I apply orange background drawable to a TextView at runtime? TIA. -- Jeff Sharkey jshar...@google.com --~--~-~--~~~---~--~~ 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: R.drawable.list_selector_background doesn't yield in orange
Slightly off-topic, but thanks for the 'Drawable mutations' blog post anyways. :) On May 6, 7:18 pm, Romain Guy romain...@google.com wrote: It's default state is transparent actually :) On Wed, May 6, 2009 at 9:10 AM, Jeff Sharkey jshar...@android.com wrote: So the list_selector_drawable is a stateful drawable, where it's default state is black. (This is why ListView unselected items are transparent/black.) The default button drawable is also stateful, but it's default state is an unpressed button. You could force it into a focused state using Drawable.setState() before setting it to the background. However, keep in mind that you probably don't want to have the TextView always appear selected, as it might confuse users to see two selected areas on screen at once. You might instead try setting the TextView to be focusable, so the background changes automatically whenever the user moves focus to the TextView. j On Wed, May 6, 2009 at 5:57 AM, gsmd gsm...@gmail.com wrote: Ok, here's a simple 'helloorange' activity: -- �...@override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText(some text); tv.setBackgroundDrawable(getResources().getDrawable (android.R.drawable.list_selector_background)); setContentView(tv); } -- When running this, the background doesn't change it's color. When I change to android.R.drawable.btn_default, it works. So, how do I apply orange background drawable to a TextView at runtime? TIA. -- Jeff Sharkey jshar...@google.com -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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: R.drawable.list_selector_background doesn't yield in orange
When user selects a TextView it 'slips' (which is indicated by background color change) and the user is expected to select(tap) another view then. Not every tap should lead to the first view losing 'focus'. That's the motivation behind setting background drawable programmatically. Ouch, this is actually more of a touch mode question. When the device goes into touch mode, there isn't a visible concept of focus in ListViews (when you scroll the list, any highlighted item reverts back). You might be looking for android:focusableInTouchMode, but this isn't used many places on the platform. -- Jeff Sharkey jshar...@google.com --~--~-~--~~~---~--~~ 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: R.drawable.list_selector_background doesn't yield in orange
Jeff, are you sure the simple example from the first post has anything to do with focus? All I want to do is to set the background of a TextView to the android.R.drawable.list_selector_background which should render in 'orange mode' as opposed to setting background to a single color (which works) or creating a custom drawable (which sounds silly in my case). On May 6, 9:49 pm, Jeff Sharkey jshar...@android.com wrote: When user selects a TextView it 'slips' (which is indicated by background color change) and the user is expected to select(tap) another view then. Not every tap should lead to the first view losing 'focus'. That's the motivation behind setting background drawable programmatically. Ouch, this is actually more of a touch mode question. When the device goes into touch mode, there isn't a visible concept of focus in ListViews (when you scroll the list, any highlighted item reverts back). You might be looking for android:focusableInTouchMode, but this isn't used many places on the platform. -- Jeff Sharkey jshar...@google.com --~--~-~--~~~---~--~~ 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: R.drawable.list_selector_background doesn't yield in orange
Sure. But in my particular case I think setting the background to standard orange is better than introducing a custom color/drawable. On May 6, 9:53 pm, Romain Guy romain...@google.com wrote: Taps should always cause focus and selection to disappear,. On Wed, May 6, 2009 at 11:49 AM, Jeff Sharkey jshar...@android.com wrote: When user selects a TextView it 'slips' (which is indicated by background color change) and the user is expected to select(tap) another view then. Not every tap should lead to the first view losing 'focus'. That's the motivation behind setting background drawable programmatically. Ouch, this is actually more of a touch mode question. When the device goes into touch mode, there isn't a visible concept of focus in ListViews (when you scroll the list, any highlighted item reverts back). You might be looking for android:focusableInTouchMode, but this isn't used many places on the platform. -- Jeff Sharkey jshar...@google.com -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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: R.drawable.list_selector_background doesn't yield in orange
If you are using this drawable for something else than indicating a selection, I totally disagree. On Wed, May 6, 2009 at 1:30 PM, alex gsm...@gmail.com wrote: Sure. But in my particular case I think setting the background to standard orange is better than introducing a custom color/drawable. On May 6, 9:53 pm, Romain Guy romain...@google.com wrote: Taps should always cause focus and selection to disappear,. On Wed, May 6, 2009 at 11:49 AM, Jeff Sharkey jshar...@android.com wrote: When user selects a TextView it 'slips' (which is indicated by background color change) and the user is expected to select(tap) another view then. Not every tap should lead to the first view losing 'focus'. That's the motivation behind setting background drawable programmatically. Ouch, this is actually more of a touch mode question. When the device goes into touch mode, there isn't a visible concept of focus in ListViews (when you scroll the list, any highlighted item reverts back). You might be looking for android:focusableInTouchMode, but this isn't used many places on the platform. -- Jeff Sharkey jshar...@google.com -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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: R.drawable.list_selector_background doesn't yield in orange
Sure. But in my particular case I think setting the background to standard orange is better than introducing a custom color/drawable. On May 6, 9:53 pm, Romain Guy romain...@google.com wrote: Taps should always cause focus and selection to disappear,. On Wed, May 6, 2009 at 11:49 AM, Jeff Sharkey jshar...@android.com wrote: When user selects a TextView it 'slips' (which is indicated by background color change) and the user is expected to select(tap) another view then. Not every tap should lead to the first view losing 'focus'. That's the motivation behind setting background drawable programmatically. Ouch, this is actually more of a touch mode question. When the device goes into touch mode, there isn't a visible concept of focus in ListViews (when you scroll the list, any highlighted item reverts back). You might be looking for android:focusableInTouchMode, but this isn't used many places on the platform. -- Jeff Sharkey jshar...@google.com -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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: R.drawable.list_selector_background doesn't yield in orange
Sure. But in my particular case I think setting the background to standard orange is better than introducing a custom color/drawable. On May 6, 9:53 pm, Romain Guy romain...@google.com wrote: Taps should always cause focus and selection to disappear,. On Wed, May 6, 2009 at 11:49 AM, Jeff Sharkey jshar...@android.com wrote: When user selects a TextView it 'slips' (which is indicated by background color change) and the user is expected to select(tap) another view then. Not every tap should lead to the first view losing 'focus'. That's the motivation behind setting background drawable programmatically. Ouch, this is actually more of a touch mode question. When the device goes into touch mode, there isn't a visible concept of focus in ListViews (when you scroll the list, any highlighted item reverts back). You might be looking for android:focusableInTouchMode, but this isn't used many places on the platform. -- Jeff Sharkey jshar...@google.com -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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: R.drawable.list_selector_background doesn't yield in orange
Ok, from pure conceptual point that IS selection. Anyways, don't think it's related to my initial question here. On May 6, 11:33 pm, Romain Guy romain...@google.com wrote: If you are using this drawable for something else than indicating a selection, I totally disagree. On Wed, May 6, 2009 at 1:30 PM, alex gsm...@gmail.com wrote: Sure. But in my particular case I think setting the background to standard orange is better than introducing a custom color/drawable. On May 6, 9:53 pm, Romain Guy romain...@google.com wrote: Taps should always cause focus and selection to disappear,. On Wed, May 6, 2009 at 11:49 AM, Jeff Sharkey jshar...@android.com wrote: When user selects a TextView it 'slips' (which is indicated by background color change) and the user is expected to select(tap) another view then. Not every tap should lead to the first view losing 'focus'. That's the motivation behind setting background drawable programmatically. Ouch, this is actually more of a touch mode question. When the device goes into touch mode, there isn't a visible concept of focus in ListViews (when you scroll the list, any highlighted item reverts back). You might be looking for android:focusableInTouchMode, but this isn't used many places on the platform. -- Jeff Sharkey jshar...@google.com -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them --~--~-~--~~~---~--~~ 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: R.drawable.list_selector_background doesn't yield in orange
View takes care of updating the drawable state as appropriate. There are methods on view you can override what it sets, but I don't think there is any API you can call to just force it to something. On Wed, May 6, 2009 at 2:04 PM, alex gsm...@gmail.com wrote: Ok, from pure conceptual point that IS selection. Anyways, don't think it's related to my initial question here. On May 6, 11:33 pm, Romain Guy romain...@google.com wrote: If you are using this drawable for something else than indicating a selection, I totally disagree. On Wed, May 6, 2009 at 1:30 PM, alex gsm...@gmail.com wrote: Sure. But in my particular case I think setting the background to standard orange is better than introducing a custom color/drawable. On May 6, 9:53 pm, Romain Guy romain...@google.com wrote: Taps should always cause focus and selection to disappear,. On Wed, May 6, 2009 at 11:49 AM, Jeff Sharkey jshar...@android.com wrote: When user selects a TextView it 'slips' (which is indicated by background color change) and the user is expected to select(tap) another view then. Not every tap should lead to the first view losing 'focus'. That's the motivation behind setting background drawable programmatically. Ouch, this is actually more of a touch mode question. When the device goes into touch mode, there isn't a visible concept of focus in ListViews (when you scroll the list, any highlighted item reverts back). You might be looking for android:focusableInTouchMode, but this isn't used many places on the platform. -- Jeff Sharkey jshar...@google.com -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- Romain Guy Android framework engineer romain...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---