Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use Custom Selector Styles on a TextView
    primarykey
    data
    text
    <p>I'm trying to figure out how to add an outer glow to a <code>TextView</code> when it's touched. The approach I'm working with is to use a Selector, but it doesn't seem to be working.</p> <p>I've got the following structure</p> <p><strong>layout\HomeView.axml</strong></p> <pre><code>&lt;TextView android:id="@+id/textview1" android:clickable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" style="@drawable/control_selector_state" /&gt; </code></pre> <p><strong>drawable\control_selector_state.xml</strong></p> <pre><code>&lt;!-- yes these are all the same for testing purposes --&gt; &lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_focused="true" style="@style/control_style_focused"/&gt; &lt;item android:state_focused="true" android:state_pressed="true" style="@style/control_style_focused" /&gt; &lt;item android:state_pressed="true" style="@style/control_style_focused" /&gt; &lt;item style="@style/control_style_focused" /&gt; &lt;/selector&gt; </code></pre> <p><strong>values\styles.xml</strong></p> <pre><code>&lt;resources&gt; &lt;style name="control_style_focused"&gt; &lt;item name="android:shadowColor"&gt;#0000ff&lt;/item&gt; &lt;item name="android:textColor"&gt;#ff0000&lt;/item&gt; &lt;item name="android:shadowDx"&gt;0.0&lt;/item&gt; &lt;item name="android:shadowRadius"&gt;8&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>The problem I'm having is that my TextView text is white, and the style doesn't seem to be applying.</p> <p>How do I get this style to apply to my TextView?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload