title: Android custom LinearLayout not appearing
body: <p>I'm facing problems when creating custom LinearLayout</p>
  
  <p>I have defined my custom layout in xml as follows</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:orientation="vertical"
  android:gravity="center_horizontal"&gt;
  
  &lt;TextView
      android:id="@+id/textViewIcon"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textSize="48sp"
      android:text="abc" /&gt;
  
  &lt;TextView
      android:id="@+id/textViewMessage"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textSize="24sp"
      android:text="abc" /&gt;
  
  &lt;Button
      android:id="@+id/btnAction"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textSize="30sp" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Then I defined some attributes in attrs.xml</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;resources&gt;
      &lt;declare-styleable name="CustomEmptyListView"&gt;
          &lt;attr name="visualIcon" format="string"/&gt;
          &lt;attr name="message" format="string"/&gt;
          &lt;attr name="textColor" format="color"/&gt;
          &lt;attr name="iconColor" format="color"/&gt;
          &lt;attr name="buttonColor" format="color"/&gt;
          &lt;attr name="buttonVisibility" format="boolean" /&gt;
          &lt;attr name="buttonText" format="string" /&gt;
      &lt;/declare-styleable&gt;
      &lt;/resources&gt;
  </code></pre>
  
  <p>Here is the code for my custom class</p>
  
  <pre><code>public class CustomEmptyListView extends LinearLayout {
      private TextView txtIcon;
      private TextView txtMessage;
      private Button btnAction;
  
      public CustomEmptyListView(Context context, AttributeSet attrs) {
          super(context, attrs);
  
  
      }
  
      public CustomEmptyListView(Context context) {
          super(context);
          LayoutInflater.from(context).inflate(R.layout.empty_listview, this);
      }
  
      public CustomEmptyListView(Context context, AttributeSet attrs, int defStyleAttr) {
          this(context, attrs);
          initViews(context, attrs);
      }
  
  
      private void initViews(Context context, AttributeSet attrs) {
          TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CustomEmptyListView, 0, 0);
          String iconText = a.getString(R.styleable.CustomEmptyListView_visualIcon);
          String message = a.getString(R.styleable.CustomEmptyListView_message);
          int buttonColor = a.getColor(R.styleable.CustomEmptyListView_buttonColor, ContextCompat.getColor(context,R.color.blueGreen));
          int textColor = a.getColor(R.styleable.CustomEmptyListView_textColor, ContextCompat.getColor(context,R.color.textCard));
          int iconColor = a.getColor(R.styleable.CustomEmptyListView_textColor, ContextCompat.getColor(context,R.color.light_grey));
          boolean btnVisible = a.getBoolean(R.styleable.CustomEmptyListView_buttonVisibility,true);
          String buttonText = a.getString(R.styleable.CustomEmptyListView_buttonText);
          a.recycle();
  
          LayoutInflater.from(getContext()).inflate(
                  R.layout.empty_listview, this);
  
          txtIcon = (TextView)findViewById(R.id.textViewIcon);
          txtIcon.setText(iconText);
          txtIcon.setTextColor(iconColor);
  
          txtMessage = (TextView)findViewById(R.id.textViewMessage);
          txtMessage.setText(message);
          txtMessage.setTextColor(textColor);
  
          btnAction = (Button)findViewById(R.id.btnAction);
          btnAction.setText(buttonText);
          btnAction.setBackgroundColor(buttonColor);
          btnAction.setTextColor(ContextCompat.getColor(context,R.color.white));
          if(btnVisible){
              btnAction.setVisibility(View.GONE);
          }else{
              btnAction.setVisibility(View.VISIBLE);
          }
      }
  }
  </code></pre>
  
  <p>And after adding it to my layout xml file as follows</p>
  
  <pre><code>&lt;com.package.views.CustomEmptyListView
          android:id="@+id/emptyListView"
          android:visibility="visible"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          custom:message="@string/no_hay_tareas_registradas"
          custom:visualIcon="@string/icon_tasks"
          android:layout_centerInParent="true"
          custom:buttonText="@string/anadir_tarea"&gt;
  
      &lt;/com.package.views.CustomEmptyListView&gt;
  </code></pre>
  
  <p>In my xml editor I only can see a 0 width and height component and nothin shows on runtime. What I'm doing wrong? 
  Thank you in advance!</p>