android-tablelayout
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
Spanning columns with TableLayout [duplicate]
add android:layout_span=”3″ to span 3 columns. For example: <TableRow> <Button android:id=”@+id/item_id” android:layout_span=”2″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”item text” /> </TableRow>
How to make a scrollable TableLayout?
Encase the whole thing in: <ScrollView android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:scrollbars=”none” android:layout_weight=”1″> <LinearLayout android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:orientation=”vertical”> … </ScrollView>
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” />
What is the equivalent of “colspan” in an Android TableLayout?
It seems that there is an attribute doing that : layout_span UPDATE: This attribute must be applied to the children of the TableRow. NOT to the TableRow itself.
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
How to get the absolute coordinates of a view
Use View.getLocationOnScreen() and/or getLocationInWindow().