I have setup a TableLayout and added a row to include a button and an ImageView. The ImageView is just a color dot. I have used the style in the past with RelativeLayout and position the ImageView above button image. The new app I am working on uses a TableLayout but when I try to setup button with ImageView it will not allow positioning. Is this option not available for TableLayout?
<TableLayout
android:id="@+id/TB1"
android:layout_width="250dp"
android:layout_height="match_parent"
android:layout_weight="1" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="@+id/Scene1"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="@drawable/custom_scene_buttons"
android:text="Scene 1"
android:textColor="@drawable/white"
android:textSize="20sp" />
<ImageView
android:id="@+id/colordot1"
android:layout_width="21dp"
android:layout_height="21dp"
android:background="@drawable/circle" />
</TableRow>
This is the code to change color dot.
Resources res = getResources();
final Drawable drawable = res.getDrawable(R.drawable.circle);
drawable.setColorFilter(Color.rgb(i, j, k), Mode.SRC_ATOP);
ImageView img = (ImageView) findViewById(R.id.colordot1);
img.setBackgroundDrawable(drawable);
Here is the linear layout option I tried
<LinearLayout android:orientation="vertical" >
<Button
android:id="@+id/Scene1"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="@drawable/custom_scene_buttons"
android:drawableRight="@drawable/circle"
android:text="Scene 1"
android:textColor="@drawable/white"
android:textSize="20sp" />
<ImageView
android:id="@+id/colordot1"
android:layout_width="21dp"
android:layout_height="21dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/circle" />
</LinearLayout>