title: declare-styleable drawableTop
body: <p>I try implement compound view for my dashboard activity. It's <code>Button</code> with <code>TextView</code>. Need for my theme.
  I have <code>attr.xml</code> file</p>
  
  <pre><code>&lt;declare-styleable name="DashboardButton"&gt;
      &lt;attr name="drawableTop" format="reference"/&gt; &lt;!-- i want set android:drawableTop of button--&gt;
      &lt;attr name="btnText" format="string" /&gt; &lt;!-- text about button functionality--&gt;
      &lt;attr name="tvText" format="string" /&gt; &lt;!-- additional information --&gt;
  &lt;/declare-styleable&gt;
  </code></pre>
  
  <p>also have <code>dashboard_button.xml</code> layout</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="wrap_content"
  android:layout_height="wrap_content" &gt;
  
      &lt;Button
          android:id="@+id/btn"
          style="@style/DashboardButton"
          android:layout_alignParentLeft="true"
          android:layout_alignParentTop="true" /&gt;
  
      &lt;TextView 
           style="@style/btn_add_info"
           android:id="@+id/txtView"
           android:text="0"/&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>also have custom component <code>DashboardButton</code></p>
  
  <pre><code>public class DashboardButton extends RelativeLayout {
  
  private TextView txtView;
  private Button btn;
  
  public DashboardButton(Context context) {
      super(context);
  }
  
  public DashboardButton(Context context, AttributeSet attrs) {
      super(context, attrs);
      LayoutInflater inflater = LayoutInflater.from(context);
      inflater.inflate(R.layout.dashboard_button, this);
      loadViews(attrs);
  }
  
  public DashboardButton(Context context, AttributeSet attrs, int defStyle) {
      super(context, attrs, defStyle);
      LayoutInflater inflater = LayoutInflater.from(context);
      inflater.inflate(R.layout.dashboard_button, this);
      loadViews(attrs);
  }
  
  private void loadViews(AttributeSet attrs) {
      txtView = (TextView) findViewById(R.id.txtView);
      btn = (Button) findViewById(R.id.btn);
      TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.DashboardButton);
      txtView.setText(a.getString(R.styleable.DashboardButton_tvText));
      btn.setText(a.getString(R.styleable.DashboardButton_btnText));
     //i think issue here but can't understand what i should do
      Drawable topDrawable = a.getDrawable(R.styleable.DashboardButton_drawableTop); 
      btn.setCompoundDrawables(null, topDrawable, null, null);
      a.recycle();
  }
  
  public void setTxtViewText(CharSequence text) {
      txtView.setText(text);
  }
  }
  </code></pre>
  
  <p>and finally i have </p>
  
  <pre><code>    &lt;my.package.name.DashboardButton
           android:id="@+id/Btn"
           style="@style/DashboardButton"
           app:btnText="@string/my_function"
           app:tvText="@string/add_info"
           app:drawableTop="@drawable/function_logo"&gt;
      &lt;/my.package.name.DashboardButton&gt;
  </code></pre>
  
  <p>All work fine, except <code>app:drawableTop</code> drawable not load at run time, I dont see drawable. Can you help me by advice?</p>