title: How to pass AttributeSet when creating view programmatically in android
body: <p>I create programmatically like horizontalview then, how to pass AttributeSet in programmatically.</p>
  
  <p>My constructor looks like this:</p>
  
  <pre><code>public HorizontalListView(Context context, AttributeSet attrs) {
          super(context, attrs);
      }
  </code></pre>
  
  <p>I have try this:</p>
  
  <pre><code>mHlvSimpleList= new HorizontalListView(mcontext,R.style.niceview);
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
    <p>The constructor HorizontalListView(Context, int) is undefined</p>
  </blockquote>
  
  <p>in style.xml</p>
  
  <pre><code>&lt;style name="niceview"&gt;
      &lt;item name="android:layout_width"&gt;wrap_content&lt;/item&gt;
      &lt;item name="android:layout_height"&gt;wrap_content&lt;/item&gt;
  
  &lt;/style&gt;
  </code></pre>
  
  <p>How to pass AttributeSet in horizontalistview constructor matching parameter?</p>