title: Android XML attribute references another xml attribute of the same type
body: <p>I have a custom View defined by this XML</p>
  
  <p><em>(part)</em></p>
  
  <pre><code>&lt;LinearLayout style="@style/LayoutVertWrapContent.SameWidth"
      android:layout_weight="2"
      android:layout_marginRight="?betweenElementsPadding"&gt;
  
      ...
      some inner views
      ...
  
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout style="@style/LayoutVertWrapContent.SameWidth"
      android:layout_weight="2"
      android:layout_marginRight="?betweenElementsPadding"&gt;
  
      ...
      some inner views
      ...
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>For this view I have declared some attributes:</p>
  
  <pre><code>&lt;declare-styleable name="TheView"&gt;
      ...
      &lt;attr name="betweenElementsPadding" format="dimension" /&gt;
  &lt;/declare-styleable&gt;
  </code></pre>
  
  <p>How can I declare this view in layout xml for an activity and pass <strong>betweenElementsPadding</strong> so that the <code>android:layout_marginRight="?betweenElementsPadding"</code> from the view's xml work?</p>
  
  <pre><code>&lt;com.blablabla.TheView
          android:id="@+id/date" 
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" 
          android:layout_gravity="center_horizontal"
          dct:betweenElementsPadding="@dimen/background_padding" /&gt;
  </code></pre>
  
  <p>The desired result is <code>android:layout_marginRight</code> for both LinearLayouts is set to <strong>betweenElementsPadding</strong>.</p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>To prevent further misunderstanding, I want to have a uniformed way of changing <strong>dct:betweenElementsPadding</strong>, say</p>
  
  <pre><code>&lt;com.blablabla.TheView
          android:id="@+id/date_1" 
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" 
          android:layout_gravity="center_horizontal"
          dct:betweenElementsPadding="3dp" /&gt;
  
  &lt;com.blablabla.TheView
          android:id="@+id/date_2" 
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" 
          android:layout_gravity="center_horizontal"
          dct:betweenElementsPadding="15dp" /&gt;
  
  &lt;com.blablabla.TheView
          android:id="@+id/date_3" 
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" 
          android:layout_gravity="center_horizontal"
          dct:betweenElementsPadding="25dp" /&gt;
  </code></pre>
  
  <p>and in each of these cases I want <strong>LinearLayout.layout_marginRight</strong> to be set to exact value of <strong>dct:betweenElementsPadding</strong>, which is 3dp, 15dp and 25dp starting from the first.</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>Using workaround partially suggested by Joe.
  In the styled constructor of the custom view I do this:</p>
  
  <pre><code>// set betweenElementsPadding
  final int betweenElementsPadding = array.getDimensionPixelSize(R.styleable.TheView_betweenElementsPadding, 0);
  ((LinearLayout.LayoutParams)((LinearLayout)findViewById(R.id.layout_1)).getLayoutParams()).rightMargin = betweenElementsPadding;
  ((LinearLayout.LayoutParams)((LinearLayout)findViewById(R.id.layout_2)).getLayoutParams()).rightMargin = betweenElementsPadding;
  </code></pre>
  
  <p>But I haven't found an answer to my original question of how to do the same with XML only.</p>