Note that there are some explanatory texts on larger screens.

plurals
  1. PODefining IDs within style, is it safe or a disaster?
    primarykey
    data
    text
    <p>Following question has kept me puzzled for a while and I thought maybe asking about this does no harm. I have the following layout.xml and style.xml files;</p> <p>res/layout/layout.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;LinearLayout style="@style/headerContainer" /&gt; &lt;LinearLayout style="@style/footerContainer" /&gt; &lt;ScrollView style="@style/contentContainer" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>res/values/style.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;style name="container"&gt; &lt;item name="android:layout_width"&gt;fill_parent&lt;/item&gt; &lt;/style&gt; &lt;style name="headerContainer" parent="container"&gt; &lt;item name="android:layout_height"&gt;40dp&lt;/item&gt; &lt;item name="android:layout_alignParentTop"&gt;true&lt;/item&gt; &lt;item name="android:background"&gt;#80FF0000&lt;/item&gt; &lt;item name="android:id"&gt;@+id/header&lt;/item&gt; &lt;/style&gt; &lt;style name="footerContainer" parent="container"&gt; &lt;item name="android:layout_height"&gt;50dp&lt;/item&gt; &lt;item name="android:layout_alignParentBottom"&gt;true&lt;/item&gt; &lt;item name="android:background"&gt;#8000FF00&lt;/item&gt; &lt;item name="android:id"&gt;@+id/footer&lt;/item&gt; &lt;/style&gt; &lt;style name="contentContainer" parent="container"&gt; &lt;item name="android:layout_height"&gt;60dp&lt;/item&gt; &lt;item name="android:layout_below"&gt;@id/header&lt;/item&gt; &lt;item name="android:layout_above"&gt;@id/footer&lt;/item&gt; &lt;item name="android:background"&gt;#800000FF&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>Now, the question is, is there a danger of overlapping IDs as I'm introducing them in style.xml? Funny thing is that this approach works, on the emulator I'm using at least, but the created IDs are not being added to the <code>R</code> class. And I'm a bit confused how they are defined once my layout is inflated.</p>
    singulars
    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