title: Custom view containing custom views with custom attributes and styling
body: <p>Normal styling for a specific View:</p>
  
  <pre><code>&lt;style name="Theme" parent="@android:style/Theme"&gt;
       &lt;item name="android:buttonStyle"&gt;@style/Button&lt;/item&gt;
       &lt;item name="customDialogStyle"&gt;@style/CustomDialogStyle&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;style name="Button" parent="@android:style/Widget.Button"&gt;
        &lt;item name="android:textColor"&gt;#000000&lt;/item&gt;
        &lt;item name="android:background"&gt;#FFFFFF&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;style name="Button.Dark"&gt;
        &lt;item name="android:textColor"&gt;#FFFFFF&lt;/item&gt;
        &lt;item name="android:background"&gt;#000000&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;style name="CustomDialogStyle"&gt;
        &lt;item name="android:buttonStyle"&gt;@style/Button.Dark&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>Some custom attributes:</p>
  
  <pre><code>&lt;attr name="customDialogStyle" format="reference" /&gt;
  
  &lt;declare-styleable name="CustomDialog"&gt;
       &lt;attr name="android:buttonStyle" /&gt;
  &lt;/declare-styleable&gt;
  </code></pre>
  
  <p>Now with my CustomView:</p>
  
  <pre><code>public class CustomDialogContainer extends LinearLayout
  {
  
       public CustomDialogContainer(Context c) { this(c, null); }
  
       public CustomDialogContainer(Context c, AttributeSet a) { this(c, a, R.attr.customDialogStyle); }
  
       public CustomDialogContainer(Context c, AttributeSet a, int d) { super(c, a, d); init(c, a, d); }
  
       private void init(Context c, AttributeSet a, int d)
       {
  
            final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CustomDialog, d, R.style.CustomDialogStyle);
  
            // tried getInteger and some others too
            int style = a.getResourceId(R.styleable.CustomDialog_buttonStyle, android.R.attr.buttonStyle);
  
            a.recycle();
  
            Button bOK = new Button(c, attrs, style);
            // and tried
            Button bCancel = new Button(c, null, style);
            // even
            Button anyOne = new Button(new ContextThemeWrapper(c, style));
  
            addView(bOK);
            addView(bCancel);
  
       }
  
  }
  </code></pre>
  
  <p>This is the very basic of my DialogContainer that has all the basics (Icon, Title, Cancel, OK, Container for other views). But what I'm obviously trying to do is apply a different style from reference to the buttons on the DialogContainer.</p>
  
  <p>Doesn't matter where this is. If I create any other ViewGroup or so and want to add some of my own CustomViews to it, if custom styling can't be done this way then I have no clue what they thought while creating Android.</p>
  
  <p>An activity with dark buttons and a bright Dialog with bright buttons - can't be too weird?
  The alternative is to add say, all the attributes individually: background, textColor, textAppearance, and so on. I thought programmers wanted to be effective.</p>
  
  <p>If someone knows how to do this, I'd appreciate some input.</p>