У меня есть макет ниже. Он динамически загружается, но иногда, если текст кнопки слишком велик, последняя кнопка btCapital9 отображается только наполовину.Последняя кнопка в таблице Android отображается наполовину
Только эта кнопка, и только в некоторых случаях. Любые идеи, почему?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="ro.giohnnysoftware.mondo.PlayVsTime"
android:background="@drawable/worldmap">
<RelativeLayout
android:id="@+id/VPlayVsTimeFooter"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true" />
<RelativeLayout
android:id="@+id/VMainContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:screenOrientation="portrait"
tools:context=".MainActivity"
android:layout_above="@+id/VPlayVsTimeFooter"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:touchscreenBlocksFocus="false">
<TextView
android:id="@+id/tvTitle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="> MONDO <"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold"
android:textSize="45dp"
android:textColor="#ff0000" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/drapel"
android:layout_below="@+id/tvTitle"
android:layout_alignRight="@+id/tvTitle" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/tvTime"
android:textColor="@android:color/white"
android:textStyle="bold"
android:textSize="@dimen/btTextSize"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true" />
<Button
android:id="@+id/btStartVsTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Start"
android:nestedScrollingEnabled="false"
android:background="@drawable/buttonshape"
android:textSize="@dimen/btTextSize"
android:textColor="@color/colorMondo1"
android:textStyle="bold"
android:layout_marginLeft="@dimen/btLeftMargin"
android:layout_marginRight="@dimen/btRightMargin"
android:layout_alignParentBottom="true"
android:onClick="StartVsTime"
android:visibility="invisible"
android:layout_marginBottom="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Country name"
android:id="@+id/tvCountry"
android:textSize="@dimen/tvCountryName"
android:textColor="@android:color/white"
android:layout_centerHorizontal="true"
android:layout_alignLeft="@+id/tvTitle"
android:layout_below="@+id/tvTitle"
android:layout_marginLeft="15dp"
android:visibility="invisible"
android:layout_marginTop="15dp"
android:shadowColor="@color/colorMondo1"
android:shadowRadius="25.0"
android:shadowDx="1.0"
android:shadowDy="1.0"
android:singleLine="false"
android:textAllCaps="true"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_below="@+id/tvCountry"
android:layout_marginTop="20dp"
android:visibility="invisible"
android:id="@+id/tbAnswers">
<TableRow
android:weightSum="2">
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="New Button"
android:id="@+id/btCapital0"
android:layout_column="0"
android:layout_weight="1"
android:background="@drawable/buttonplay"
android:layout_marginRight="2dp"
android:textColor="@color/colorMondo1"
android:textSize="@dimen/btPlayTextSize"
android:textAllCaps="false"
android:layout_gravity="top"
android:layout_marginTop="5dp" />
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="New Button"
android:id="@+id/btCapital1"
android:layout_column="1"
android:layout_weight="1"
android:background="@drawable/buttonplay"
android:layout_marginLeft="2dp"
android:textColor="@color/colorMondo1"
android:textSize="@dimen/btPlayTextSize"
android:textAllCaps="false"
android:layout_gravity="top"
android:layout_marginTop="5dp" />
</TableRow>
<TableRow
android:weightSum="2">
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="New Button"
android:id="@+id/btCapital2"
android:layout_column="0"
android:layout_weight="1"
android:background="@drawable/buttonplay"
android:layout_marginRight="2dp"
android:textColor="@color/colorMondo1"
android:textSize="@dimen/btPlayTextSize"
android:textAllCaps="false"
android:layout_gravity="top"
android:layout_marginTop="5dp" />
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="New Button"
android:id="@+id/btCapital3"
android:layout_column="1"
android:layout_weight="1"
android:background="@drawable/buttonplay"
android:layout_marginLeft="2dp"
android:textColor="@color/colorMondo1"
android:textSize="@dimen/btPlayTextSize"
android:textAllCaps="false"
android:layout_gravity="top"
android:layout_marginTop="5dp" />
</TableRow>
<TableRow
android:weightSum="2">
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="New Button"
android:id="@+id/btCapital4"
android:layout_column="0"
android:layout_weight="1"
android:layout_marginRight="2dp"
android:background="@drawable/buttonplay"
android:textColor="@color/colorMondo1"
android:textSize="@dimen/btPlayTextSize"
android:textAllCaps="false"
android:layout_gravity="top"
android:layout_marginTop="5dp" />
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="New Button"
android:id="@+id/btCapital5"
android:layout_column="1"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:background="@drawable/buttonplay"
android:textColor="@color/colorMondo1"
android:textSize="@dimen/btPlayTextSize"
android:textAllCaps="false"
android:layout_gravity="top"
android:layout_marginTop="5dp" />
</TableRow>
<TableRow
android:weightSum="2">
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="New Button"
android:id="@+id/btCapital6"
android:layout_column="0"
android:layout_weight="1"
android:layout_marginRight="2dp"
android:background="@drawable/buttonplay"
android:textColor="@color/colorMondo1"
android:textSize="@dimen/btPlayTextSize"
android:textAllCaps="false"
android:layout_gravity="top"
android:layout_marginTop="5dp" />
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="New Button"
android:id="@+id/btCapital7"
android:layout_column="1"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:background="@drawable/buttonplay"
android:textColor="@color/colorMondo1"
android:textSize="@dimen/btPlayTextSize"
android:textAllCaps="false"
android:layout_gravity="top"
android:layout_marginTop="5dp" />
</TableRow>
<TableRow
android:weightSum="2">
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="New Button"
android:id="@+id/btCapital8"
android:layout_column="0"
android:layout_weight="1"
android:layout_marginRight="2dp"
android:background="@drawable/buttonplay"
android:textColor="@color/colorMondo1"
android:textSize="@dimen/btPlayTextSize"
android:textAllCaps="false"
android:layout_gravity="top"
android:layout_marginTop="5dp" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/btCapital9"
android:layout_column="1"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:background="@drawable/buttonplay"
android:textColor="@color/colorMondo1"
android:textSize="@dimen/btPlayTextSize"
android:textAllCaps="false"
android:layout_gravity="top"
android:layout_marginTop="5dp" />
</TableRow>
</TableLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/tvPoints"
android:textColor="@android:color/white"
android:textStyle="bold"
android:textSize="@dimen/btTextSize"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
</RelativeLayout>
не видел. спасибо –
Нет проблем. Я действительно думаю, что вам может быть лучше использовать LinearLayout (по горизонтали) для каждой строки, завернутой в LinearLayout (по вертикали). Это позволит вашему виду масштабироваться, и он также, вероятно, будет работать быстрее. –