Android content res colorstatelist

Color State List Class

Definition

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Lets you map android.view.View state sets to colors.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Creates a ColorStateList with the same properties as another ColorStateList.

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

Returns a mask of the configuration parameters for which this color state list may change, requiring that it be re-created.

Returns the runtime class of this Object .

(Inherited from Object) Creator DefaultColor

Return the default color in this ColorStateList .

The handle to the underlying Android instance.

(Inherited from Object) IsOpaque

Indicates whether this color state list is opaque, which means that every color returned from #getColorForState(int[], int) has an alpha value of 255.

Indicates whether this color state list contains at least one state spec and the first spec is not empty (e.

JniIdentityHashCode (Inherited from Object) JniPeerMembers PeerReference (Inherited from Object) ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

Creates and returns a copy of this object.

(Inherited from Object) CreateFromXml(Resources, XmlReader)

Creates a ColorStateList from an XML document.

Creates a ColorStateList from an XML document.

Describe the kinds of special objects contained in this Parcelable’s marshalled representation.

Dispose() (Inherited from Object) Dispose(Boolean) (Inherited from Object) Equals(Object)

Indicates whether some other object is «equal to» this one.

(Inherited from Object) GetColorForState(Int32[], Color)

Читайте также:  Dns сервер недоступен андроид

Return the color associated with the given set of android.view.View states.

Returns a hash code value for the object.

(Inherited from Object) JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object) Notify()

Wakes up a single thread that is waiting on this object’s monitor.

(Inherited from Object) NotifyAll()

Wakes up all threads that are waiting on this object’s monitor.

(Inherited from Object) SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object) ToArray () (Inherited from Object) ToString()

Returns a string representation of the object.

(Inherited from Object) UnregisterFromRuntime() (Inherited from Object) ValueOf(Color) Wait()

Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.

(Inherited from Object) Wait(Int64)

Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.

(Inherited from Object) Wait(Int64, Int32)

Causes the current thread to wait until another thread invokes the java.lang.Object#notify() method or the java.lang.Object#notifyAll() method for this object.

(Inherited from Object) WithAlpha(Int32)

Creates a new ColorStateList that has the same states and colors as this one but where each color has the specified alpha value (0-255).

Creates a new ColorStateList that has the same states and colors as this one but where each color has the specified perceived luminosity value (0-100).

Flatten this object in to a Parcel.

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

Performs an Android runtime-checked type conversion.

Источник

Resources. Get Color State List Method

Definition

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Returns a color state list associated with a particular resource ID.

Returns a color state list associated with a particular resource ID.

GetColorStateList(Int32)

Returns a color state list associated with a particular resource ID.

Parameters

The desired resource identifier of a ColorStateList , as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.

Returns

A ColorStateList object containing either a single solid color or multiple colors that can be selected based on a state.

Exceptions

Throws NotFoundException if the given ID does not exist.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Читайте также:  Найти майл ру для андроид

Applies to

GetColorStateList(Int32, Resources+Theme)

Returns a color state list associated with a particular resource ID.

Parameters

The desired resource identifier of a ColorStateList , as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.

Returns

A ColorStateList object containing either a single solid color or multiple colors that can be selected based on a state.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Источник

Resources. Get Color State List Method

Definition

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Returns a color state list associated with a particular resource ID.

Returns a color state list associated with a particular resource ID.

GetColorStateList(Int32)

Returns a color state list associated with a particular resource ID.

Parameters

The desired resource identifier of a ColorStateList , as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.

Returns

A ColorStateList object containing either a single solid color or multiple colors that can be selected based on a state.

Exceptions

Throws NotFoundException if the given ID does not exist.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

GetColorStateList(Int32, Resources+Theme)

Returns a color state list associated with a particular resource ID.

Parameters

The desired resource identifier of a ColorStateList , as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.

Returns

A ColorStateList object containing either a single solid color or multiple colors that can be selected based on a state.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Источник

Remote Views. Set Color State List Method

Definition

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Call a method taking one ColorStateList on a view in the layout for this RemoteViews.

Call a method taking one ColorStateList on a view in the layout for this RemoteViews.

Call a method taking one ColorStateList on a view in the layout for this RemoteViews.

Читайте также:  Плеер для андроида полные версии

SetColorStateList(Int32, String, ColorStateList)

Call a method taking one ColorStateList on a view in the layout for this RemoteViews.

Parameters

The id of the view on which to call the method.

The name of the method to call.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

SetColorStateList(Int32, String, Int32)

Call a method taking one ColorStateList on a view in the layout for this RemoteViews.

Parameters

The id of the view on which to call the method.

The name of the method to call.

The resource to resolve and pass as argument to the method.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

SetColorStateList(Int32, String, ColorStateList, ColorStateList)

Call a method taking one ColorStateList on a view in the layout for this RemoteViews.

Parameters

The id of the view on which to call the method.

The name of the method to call.

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Источник

Использование селектора для изменения цвета текста TextView

Я пытаюсь использовать TextView для определения стиля TabWidget на tabhost.

Я просто создал селектор для bgcolor и отлично работает, но я хочу сделать селектор для textColor, но цвет текста не изменяется:

Это мой tab_text_selector.xml:

И это код, когда я пытаюсь использовать в textView:

Я знаю, что цвет текста должен быть белым в любом случае, но это не так.

Вы должны использовать getColorStateList () . И для xml, см. Здесь

Я также боролся с этой проблемой, если вы хотите использовать state list , вам нужно объявить его в папке с color ресурсами вместо drawable папки и использовать setTextColor(getResources().getColorStateList(R.color.tab_text_selector)) .

1) Используйте tab_text_selector.xml, как показано ниже, и поместите его в папку res / color:

И установите его в текст, как показано ниже.

2) Второй вариант: если вы используете textview в xml вместо использования программной программы, используйте tab_text_selector.xml, как показано ниже:

Используйте этот способ:

Но лучше поместить цвет в /res/color/yourcolor.xml

Просто сделайте Selector для textcolor

Затем установите для свойства textColor Textview значение clickable = true

@ Ffleandro, @ ρяσѕρєя K отвечает на лучший вариант, я думаю, используя лучший выбор ColorStateList для более старых и последних версий Android.

Вы использовали белый цвет во всех случаях фокус, выбранный и нажатый.

Пожалуйста, используйте и протестируйте с другим цветом.

Также необходимо использовать случай по умолчанию с определенным цветом, например black, вместе со всем случаем .. когда не используется состояние по умолчанию.

Источник

Оцените статью