Надеюсь, этот код поможет вам .. открытый класс MainActivity расширяет Activity {
могу заставить мой TableLayout поместиться внутри экранаwhen the text cell is large
несмотря на текстовые переноскиinside the cell
.
Это мой TableLayout. Простая таблица с двумя строками и двумя столбцами. Ячейки левого столбцаmultiline
, Если текст одной из этих ячеек достаточно большой, чтобы разбить его на две строки, столбец растягивается, чтобы заполнить весь экран, а правые столбцы выталкиваются за пределы экрана.
Зачем? Как заставить полный стол оставаться внутри экрана? Любая подсказка приветствуется.
Мой TableLayout является следующим:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myTableLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TableRow>
<TextView
android:text="Account 4 with a very large name to see if it breaks on two or more lines"
android:singleLine="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
</TextView>
<TextView
android:text="$400.00"
android:gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
</TextView>
</TableRow>
<TableRow>
<TextView
android:text="Account 5"
android:singleLine="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
</TextView>
<TextView
android:text="$400.00"
android:gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
</TextView>
</TableRow>
</TableLayout>
Код для отображения макета является основным:
public class AccountBrowserTest
extends Activity
{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
this.setContentView(R.layout.accountbrowser_test);
}
}