Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid style lookup in library project
    primarykey
    data
    text
    <p>I am having the hardest time trying to get this to work. I have a custom control that I have moved into a library project which is referenced from my main app project. In the library project, I have a few styleable attrs defined (ignore the typo in the last one, fixing :-)):</p> <pre><code>&lt;declare-styleable name="PinLockKeyPad"&gt; &lt;attr name="keypadKeyBackground" format="reference" /&gt; &lt;attr name="cancelKeyBackground" format="reference" /&gt; &lt;attr name="keypadButtonTextSize" format="dimension" /&gt; &lt;attr name="cancelButtonTextSize" format="dimension" /&gt; &lt;attr name="backspaceButtonImageResouce" format="reference" /&gt; &lt;/declare-styleable&gt; </code></pre> <p>These styleable attrs are not referenced in java code anywhere but are used in the library's styles.xml file like so:</p> <pre><code>&lt;style name="KeypadButton" parent="MatchBoth"&gt; &lt;item name="android:background"&gt;?keypadKeyBackground&lt;/item&gt; &lt;item name="android:textColor"&gt;@color/white&lt;/item&gt; &lt;item name="android:textSize"&gt;?keypadButtonTextSize&lt;/item&gt; &lt;item name="android:textStyle"&gt;bold&lt;/item&gt; &lt;item name="android:typeface"&gt;sans&lt;/item&gt; &lt;item name="android:layout_weight"&gt;1&lt;/item&gt; &lt;/style&gt; </code></pre> <p>In my main app I have done the following in styles.xml:</p> <pre><code>&lt;style name="Theme.App" parent="@style/Theme.Sherlock.Light.DarkActionBar.ForceOverflow"&gt; &lt;item name="keypadKeyBackground"&gt;@drawable/keypad_key&lt;/item&gt; &lt;item name="cancelKeyBackground"&gt;@drawable/keypad_key&lt;/item&gt; &lt;item name="pinHintTextColor"&gt;@color/white&lt;/item&gt; &lt;item name="pinInputBackground"&gt;@color/white&lt;/item&gt; &lt;item name="keypadButtonTextSize"&gt;18sp&lt;/item&gt; &lt;item name="cancelButtonTextSize"&gt;18sp&lt;/item&gt; &lt;item name="backspaceButtonImageResouce"&gt;@drawable/ic_delete&lt;/item&gt; &lt;/style&gt; </code></pre> <p>And have set Theme.App to by my applications theme. However, I am getting crashes when trying to inflate the classes which reference the KeypadButton style due to these attrs not being defined. What am I missing?</p> <p>Sidenote: this may be associated with having multiple libraries in my main app. I have another app which does this EXACT same thing and does not crash, but it only uses one library (the one where these styles are used).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
    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