正如您在下面的屏幕截图中看到的那样,表格行与父级不匹配的右侧有一个小间隙。最好在分隔线中查看,但所有内容均不完全匹配父项。我对此束手无策。任何帮助将不胜感激。
我的最终目标是匹配 pc 版本使用的我的 java swing 布局。所有 3 列的宽度相同。
这是我的xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/bordered_popupmenu"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<com.kisnardonline.helpers.FontTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text="@string/myclient_inspect_title"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="22sp" />
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_close_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|top"
android:layout_margin="5dp"
android:text="x"
android:textColor="@color/THEME_BAD_COLOR_TEXT"
android:textSize="22sp"
android:textStyle="bold" />
</LinearLayout>
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/bordered_popupmenu">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp">
<ImageView
android:id="@+id/game_popup_item_imageview"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_margin="1dp"
android:adjustViewBounds="true"
android:background="@drawable/bordered_popupmenu" />
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_quantity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text="(0)"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="18sp" />
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text='"Item name"'
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="18sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp">
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_span="3"
android:text="Description"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="16sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_marginTop="14dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="5dp">
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_required"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_span="3"
android:text="@string/itempopup_required_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp">
<View
android:id="@+id/divider3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_span="3"
android:background="@color/THEME_LIGHT_TEXT" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp">
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_required_strength"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text="@string/itempopup_requiredstrength_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_required_level"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text="@string/itempopup_requiredlevel_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_required_dexterity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text="@string/itempopup_requireddexterity_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp">
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_required_constitution"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text="@string/itempopup_requiredconstitution_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_required_skill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text="@string/itempopup_requiredskill_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_required_intelligence"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text="@string/itempopup_requiredintelligence_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp">
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_required_skilltype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_span="3"
android:text="@string/itempopup_requiredskilltype_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_marginTop="12dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="5dp">
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_increases"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_span="3"
android:text="@string/itempopup_increases_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp">
<View
android:id="@+id/divider4"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_span="3"
android:background="@color/THEME_LIGHT_TEXT" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp">
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_strength_increase"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text="@string/itempopup_strengthincrease_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_skill_increase"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text="@string/itempopup_skillincrease_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_dexterity_increase"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text="@string/itempopup_dexterityincrease_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp">
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_constitution_increase"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text="@string/itempopup_constitutionincrease_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_skilltype_increase"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text="@string/itempopup_skilltype_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
<com.kisnardonline.helpers.FontTextView
android:id="@+id/game_popup_item_intelligence_increase"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:text="@string/itempopup_intelligenceincrease_text"
android:textColor="@color/THEME_LIGHT_TEXT"
android:textSize="14sp" />
</TableRow>
</TableLayout>
</LinearLayout>
编辑