title: Android: How to Create a Custom button widget
body: <p>I would like to create a button with circular or rectangular background, text and an image below or above the text.</p>
  
  <p>Here is the CustomButton Layout where I added the objects (background and text - ImageView is missing):</p>
  
  <pre><code>&lt;FrameLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_height="wrap_content"
   android:orientation="horizontal" android:layout_width="wrap_content" android:layout_gravity="center_vertical|center_horizontal"&gt;
  </code></pre>
  
  <p>
  
  </p>
  
  <p>I would like to create a CustomButton object with methods setText() and setImage() which would change the button text and image and place multiple CustomButtons into main layout.</p>
  
  <p>Does anyone know how to create a custom layout, place it into another layout(main) and modify its elements from the activity which is bound to main layout?</p>
  
  <p>I would really appreciate your help.</p>
  
  <p>Thanks!</p>