android - 在 LinearLayout 中将 TableLayout 居中
问题描述
Android新手在这里。
<LinearLayout
android:layout_below="@+id/mMainTop"
android:layout_above="@+id/mMainBottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
// some TextView
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mSubTable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
如何参考父级中剩余的空间TableLayout
垂直居中?LinearLayout
我希望有人能理解我的意思。
解决方案
尝试android:layout_gravity="center"
在android:layout_gravity="center_vertical"
您的 TableLayout 中制作
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mSubTable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
推荐阅读
- javascript - 典型的 HTTP 会话,但 Ajax 风格
- c# - Xamarin 形式。如何绑定选择器的选定项目以在切换视图时显示在选择器字段中?
- javascript - JavaScript fetch() - 将 ReadableStreams 数组映射到数组
- netlogo - Netlogo:通过滑块输入概率
- big-o - 试图理解这个 big0 符号的复杂性
- python - 生成与任意维度上的一组其他向量正交的向量
- c++ - 如何通过指定的行和列获取 Clang AST 节点?
- python - Reportlab,如何更改页面方向?
- python - 在张量流中逐元素地从两个张量中获取更高的值
- r - 使用 styler 设置 R 代码样式时,使用 = 而不是 <- 进行赋值