Wednesday, February 23, 2011

[android-developers] Re: Changing tab background image

I created some entries in color.xml to create color and then done
whatever u have said.
in tab_layout xml, i have put android:textcolor="@layout/selector"

It is giving error
02-23 13:23:11.334: ERROR/AndroidRuntime(7423): Caused by:
android.content.res.Resources$NotFoundException: File res/layout/
tab_text_color_selector.xml from color state list resource ID
#0x7f030056

02-23 13:23:11.334: ERROR/AndroidRuntime(7423): Caused by:
org.xmlpull.v1.XmlPullParserException: Binary XML file line #3: <item>
tag requires a 'android:color' attribute.

I am not able to understand this error. Please check it.

thanks in advance
~Manish

On Feb 21, 5:34 pm, Nguyen Dat <nguyenda...@gmail.com> wrote:
> Hi cool.manish
>
> For custom selector, try this:
> sample_selector.xml
>
> <?xml version="1.0" encoding="utf-8"?>
> <selector xmlns:android="http://schemas.android.com/apk/res/android">
>     <item android:state_focused="true" android:drawable="@color/black" />
> <!-- focused -->
>     <item android:state_focused="true" android:state_pressed="true"
> android:drawable="@color/black" /> <!-- focused and pressed-->
>     <item android:state_pressed="true" android:drawable="@color/green" />
> <!-- pressed -->
>     <item android:drawable="@color/black" /> <!-- default -->
> </selector>
>
> Notice that:
> #android:background
> was replace by
> #android:drawable <= you can also set color or drawable here
>
> Regards,
> DatNQ
>
>
>
> On Mon, Feb 21, 2011 at 2:36 PM, cool.manish <mannishga...@gmail.com> wrote:
> > Thanks Mark. I did that but some time when coming back on this
> > screen(calendar), I want to hightlight one particular date grid cell
> > and i haven't grid cell object with me. because i want to click on
> > based on date and that particular date could be on any cell. I will
> > not be sure about the position.
>
> >  1. My tab is displaying some text which consuming more than the
> > > available space because of it on focused tab text is scrolling. I want
> > > to display this text as multiline. Is it possible?
>
> > [Mark]Use the version of setIndicator() that takes a View and design
> > your
> > own layout for the faces of the tabs.
>
> > Mark, in this thread you had suggested to use xml for the tab. I am
> > not sure how to maintain the color of textview at the the of selection
> > of a tab. I tried to create xml for state change but textcolor
> > property is not there and using background property giving exception.
> > As i was trying to set it in textcolor property of the textView.
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <LinearLayout
> >  xmlns:android="http://schemas.android.com/apk/res/android"
> >  android:layout_width="fill_parent"
> >  android:layout_height="fill_parent"
> >  android:padding="10dip"
> >  android:background="@layout/mailbox_tab_bg_state">
>
> >        <TextView
> >                android:id="@+id/tabTxt"
> >                android:text="list view"
> >                android:layout_width="wrap_content"
> >                android:layout_height="wrap_content"
> >                android:layout_gravity="center"
> > android:textColor="@layout/tab_highligh>
> >        </TextView>
> > </LinearLayout>
>
> > <selector xmlns:android="http://schemas.android.com/apk/res/android">
> >        <item android:state_selected="true" android:state_pressed="false"
>
> >  android:background="#FFFFFFFF" />
> > </selector>
>
> > On Feb 18, 6:00 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> > > On Fri, Feb 18, 2011 at 12:20 AM, cool.manish <mannishga...@gmail.com>
> > wrote:
> > > > as Mark told, we can't apply state change logic in btn. Is there any
> > > > other way?
>
> > > Just set a new image when the button or whatever is clicked.
>
> > > --
> > > Mark Murphy (a Commons Guy)http://commonsware.com|
> >http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > > Android 2.3 Programming Books:http://commonsware.com/books
>
> > --
> > 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+unsubscribe@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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment