一:TableLayout支持列扩展不支持行扩展
TableLayout列扩展,比如一个button扩展到两列
android:layout_span属性
<Button
android:id="@+id/btn_zero"
android:text="0"
android:layout_span="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
效果:
二:GridLayout的行扩展和列扩展
1.列扩展
<com.example.kirito.simplecalculate.CustomButton
android:id="@+id/btn_zero"
android:text="0"
android:layout_gravity="fill_horizontal"
android:layout_columnSpan="2"
android:layout_span="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
2.行扩展
<com.example.kirito.simplecalculate.CustomButton
android:id="@+id/btn_zero"
android:text="0"
android:layout_gravity="fill_horizontal"
android:layout_columnSpan="2"
android:layout_span="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
效果: