我的工作环境是Eclipse heliose,Android 1.6
我已经创建了一个tableLayout,其中列和行已成功添加,每个单元格都有一个textView和一个EditText,我在访问每个单元格时遇到问题,需要在单元格内的每个editText中添加addTextChangedListener.所以我需要将英文文本更改为指示文本.请提出解决方案
/**
* Here we are going to define the grid The Grid has 1. grid's value in the
* particular position 2.
*/
public void setGrid() {
String questionNumber[] = null;
Typeface fontface = Typeface.createFromAsset(getAssets(), "fonts/padmaa.ttf");
/*
* Table layout for the crossword elements
*/
TableLayout tableLayout = (TableLayout) findViewById(R.id.crosswordTableLayout);
tableLayout.setGravity(Gravity.TOP);
tableLayout.setBackgroundColor(Color.WHITE);
tableLayout.setScrollContainer(true);
for (int i = 0; i < sizeOfGrid; i++) {
/*
* This table row params is used to set the layout params …Run Code Online (Sandbox Code Playgroud) 由于使用表格布局构建动态表格对我来说还不够.我想知道我是否可以像这样获取数据网格视图(来自MyData应用程序)

功能是:
有没有开源或商业等价物?!
我想为Android应用程序创建一个登录屏幕.我正在使用TableLayout正确的对齐方式.因此,两行由a TextView和a组成,EditText我想Button在它们下方添加一个宽度拉伸到屏幕.所以我把它Button放在另一个TableRow,我添加layout_span="2"了Button,但是Button显示在第一列.
我认为这应该是正确的,但我必须在xml文件中做错.你知道出了什么问题吗?
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".LoginActivity"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="15dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/evUsername" />
<EditText
android:id="@+id/username"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="text" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="15dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/evPassword" />
<EditText
android:id="@+id/password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="textPassword" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/btnLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_span="2"
android:text="@string/btnLogin" />
</TableRow>
</TableLayout> …Run Code Online (Sandbox Code Playgroud) 我遇到了问题TableLayout.
首先,看一下截图:

正如你所看到的,中间有一个相当大的空间TableLayout.我不知道如何减少中间的空间,以便TableRows将更多的宽度覆盖.而且,我想减少a TableRow和它下面的空间之间的空间.
我正在以TableLayout编程方式添加视图.另外,我已经把" layout_weight"的内容TableRow到1F:
TableRow tr = (TableRow) new TableRow(mTableLayout.getContext());
TableRow.LayoutParams params = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT);
NormalCard card = new NormalCard();
card.setLayoutParams(new TableRow.LayoutParams(0, 740, 1f));
tr.addView(card);
mTableLayout.addView(tr, params);
Run Code Online (Sandbox Code Playgroud)
XML声明TableLayout:
<TableLayout
android:id="@+id/tableLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:shrinkColumns="*"
android:stretchColumns="*"
android:dividerPadding="0dp"
android:showDividers="none"
android:divider="@null">
</TableLayout>
Run Code Online (Sandbox Code Playgroud)
如何减少中间的空间TableLayout.而且,如何减少a TableRow和它下面的空间之间的空间.
先谢谢你.
我正在尝试做我的第一个复杂的GUI,但现在我无法解决这个问题.

前两行的第一列只需要包含标签,而前两行的第二列必须占用剩余空间.
在这张快照中,我注意到的问题是第一列比我想要的要大.
这是实现该布局的一段代码.
...
...
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/linear_layout_background"
android:stretchColumns="*"
android:shrinkColumns="*">
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp" >
<TextView
android:id="@+id/textViewPlateValueLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/plateValue"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/productID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/back"
android:ems="5"
android:text="@string/blank"
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp" >
<TextView
android:id="@+id/ztlLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ztl"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/ztlShow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/back"
android:text="@string/blank"
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:gravity="center" >
<TextView
android:id="@+id/isAllowed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/blank"
android:background="@drawable/back"
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
</TableLayout>
...
...
Run Code Online (Sandbox Code Playgroud)
另外,由于它们确实不切实际,我想问你一些关于最佳使用方法的建议.
我需要显示边框TableRow在TableLayout.
我该怎么办?
有没有办法TableLayout完全设计风格?
我发现[这]但我想知道是否有办法将样式应用于表而不是单独的行.我有很多表,我不想单独为每一行应用样式.
我尝试将样式应用于TableLayout但是styleXML中的标记没有android:tablerow item.
如果我可以做这样的事情,那将是理想的:
<style name="Table" parent="android:Theme">
<item name="android:textSize">24sp</item>
<item name="android:padding">10dp</item>
<item name="android:tablerow">@style/TableRow</item>
</style>
Run Code Online (Sandbox Code Playgroud) 我想在行的右侧创建一个带有按钮的表,如下所示.我想在每行的右侧设置填充,但这会"吃掉"最右边的按钮.有没有办法填充填充而不影响按钮的显示?

这是我的布局xml代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp" >
<TableLayout
android:id="@+id/tbl_test"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:orientation="vertical"
android:layout_marginTop="1dp"
android:layout_marginBottom="1dp"
android:stretchColumns="1"
>
<TableRow android:background="#ffffff" android:layout_margin="1dp">
<TextView android:text="Col 1" android:layout_column="0" />
<TextView android:text="Col 2" android:layout_column="1" />
<TextView android:text="Col 3" android:layout_column="2" />
<TextView android:text="Col 4" android:layout_column="3" />
</TableRow>
<TableRow
android:background="#ffffff"
android:layout_marginLeft="1dp"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp">
<TextView android:text="r1" android:layout_column="0" />
<TextView android:text="padding right 0dp" android:layout_column="1" />
<Button android:text="edit" />
<Button android:text="delete" />
</TableRow>
<TableRow
android:background="#ffffff"
android:layout_marginLeft="1dp"
android:layout_marginRight="1dp"
android:layout_marginBottom="1dp"
android:paddingRight="2dp">
<TextView android:text="r2" android:layout_column="0" />
<TextView android:text="padding right 1dp" android:layout_column="1" …Run Code Online (Sandbox Code Playgroud) 我想创建一个由DB数据填充的表.我知道这是可以创建使用动态表TableLayout ,但我不知道这是最好的解决办法即时通讯我的情况.
这是我想要创建的示例(页面上的第一个表).
我可以设置android:shrinkColumns和android:stretchColumns在 TableLayout.
例如:
<TableLayout
android:shrinkColumns="2,3"
android:stretchColumns="1,3"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
Run Code Online (Sandbox Code Playgroud)
那么这个属性如何影响列?