XML Table layout? Two EQUAL-width rows filled with equally width buttons?

To have buttons in rows where buttons are the same size you need to do. <LinearLayout android:orientation=”horizontal” android:layout_width=”fill_parent” android:layout_height=”fill_parent”> <Button android:layout_weight=”1″ android:layout_height=”wrap_content” android:layout_width=”0dip”/> <Button android:layout_weight=”1″ android:layout_height=”wrap_content” android:layout_width=”0dip”/> </LinearLayout> And fill in the other xml properties for your buttons. The magic is in the layout_weight and width properties. You don’t need the Table layout. These properties … Read more

How can I highlight the table row on click ?

If you want to use the stock on click highlight like you get with a generic ListView, you want to set the background of each row to be android:background=”@android:drawable/list_selector_background” Here is an example: <TableLayout android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:stretchColumns=”0″> <TableRow android:id=”@+id/first_row” android:background=”@android:drawable/list_selector_background” > … row content … </TableRow> </TableLayout> Then in code, TableRow firstRow = (TableRow) findViewById(R.id.first_row); … Read more

TabLayout Tab Title text in Lower Case

If you add the following line to your TabLayout it should work: app:tabTextAppearance=”@android:style/TextAppearance.Widget.TabWidget” Use it like this: <android.support.design.widget.TabLayout android:id=”@+id/tabLayout” android:layout_width=”match_parent” android:layout_height=”wrap_content” app:tabIndicatorColor=”@android:color/white” app:tabIndicatorHeight=”2dp” app:tabTextAppearance=”@android:style/TextAppearance.Widget.TabWidget” app:tabSelectedTextColor=”@android:color/white” app:tabTextColor=”@android:color/white” />

Custom Adapter for List View

public class ListAdapter extends ArrayAdapter<Item> { private int resourceLayout; private Context mContext; public ListAdapter(Context context, int resource, List<Item> items) { super(context, resource, items); this.resourceLayout = resource; this.mContext = context; } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi; vi = LayoutInflater.from(mContext); v … Read more