标签: tablelayout

在TableRow上以编程方式居中TextView

我试图将一个textview集中在一个tablerow中,它本身就在一个tablelayout中,但我想我错过了一些东西,因为TextView没有集中:s

这是我的方法:

private void insertClock() {


        TableLayout table = new TableLayout(this);
        table.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        table.setStretchAllColumns(true);

        TableRow tbRow = new TableRow(this);
        TableLayout.LayoutParams layoutRow = new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);




        clock = new TextView(this);
        TableRow.LayoutParams layoutHistory = new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);  


        clock.setLayoutParams(layoutHistory);
        clock.setText(calculateClockText());
        tbRow.setLayoutParams(layoutRow);
        table.addView(tbRow);
        clock.setGravity(Gravity.CENTER_HORIZONTAL);
        tbRow.addView(clock);

    }
Run Code Online (Sandbox Code Playgroud)

提前致谢 ;)

android center tablelayout textview tablerow

1
推荐指数
1
解决办法
5471
查看次数

如何以编程方式在表格行中添加图像?

我正在开发一个 android 应用程序。我需要用图像填充我的列表。我想使用数组在表格布局中逐行插入图像。你能指导我怎么做吗?谢谢你。

android image tablelayout

1
推荐指数
1
解决办法
7728
查看次数

如何以编程方式跨越tablelayout中的列?

我有一个动态的tablelayout,我以编程方式构建.每隔一段时间,其中一行就有一个子SeekBar.

有关如何以编程方式使这些SeekBars跨越所有表列的任何建议?

谢谢.

html android tablelayout seekbar

0
推荐指数
1
解决办法
2710
查看次数

在android中创建动态表

我试图从二维字符串数组创建一个表.但是,我厌倦了在代码中创建视图,因此出于某种原因,我的图像永远不可见,我的文本视图不会分成多行,而是会删除文本.

另外,我在我的代码中的每个textview上都放了id,当有人点击textview时,我希望我可以使用该ID来识别点击的行.不幸的是,事实并非如此.

有没有什么好方法可以识别正确的排?

问候

      for (int current=0; current<cityArr.length; current++) {

      TableRow tr = new TableRow(this);
      tr.setId(100+current);
      tr.setLayoutParams(new LayoutParams(
              LayoutParams.FILL_PARENT,
              LayoutParams.WRAP_CONTENT));   

      TextView labelTV = new TextView(this);
      labelTV.setId(current);
      labelTV.setText(cityArr[current][0]);
      labelTV.setTextColor(Color.BLACK);
      labelTV.setLayoutParams(new LayoutParams(
              LayoutParams.FILL_PARENT,
              LayoutParams.WRAP_CONTENT));
      tr.addView(labelTV);

      ImageView mapView = new ImageView(this);
      mapView.setImageResource(R.drawable.list_icon_map);
      mapView.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT, 5));
      tr.addView(mapView);

      tlcity.addView(tr, new TableLayout.LayoutParams(
              LayoutParams.FILL_PARENT,
              LayoutParams.WRAP_CONTENT));
  }
Run Code Online (Sandbox Code Playgroud)

android tablelayout tablerow layoutparams

0
推荐指数
1
解决办法
9702
查看次数

如何在TableLayout中创建一个空TableRow

我的andriod应用程序有以下布局.

<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/ULC Background"
android:stretchColumns="1">
    <!--Below I try to create an 'empty' table to push down the buttons 200 pixels, but it doesn't work, it doesn't affect the layout at all-->
    <TableRow android:id="@+id/tableRow3" android:layout_width="fill_parent" android:layout_height="200dip"></TableRow>
    <TableRow android:layout_height="wrap_content" android:id="@+id/tableRow1" android:layout_width="wrap_content">
        <Button android:text="@string/startButtonText" android:layout_width="wrap_content" android:id="@+id/button1" android:layout_height="wrap_content"></Button>
    </TableRow>
    <TableRow android:layout_height="wrap_content" android:id="@+id/tableRow2" android:layout_width="wrap_content">
        <Button android:text="@string/exitButtonText" android:layout_width="wrap_content" android:id="@+id/button2" android:layout_height="wrap_content"></Button>
    </TableRow>
</TableLayout>
Run Code Online (Sandbox Code Playgroud)

按钮在顶部看起来很奇怪,我希望它们按下200像素,我该怎么做?

我尝试创建一个'空'TableRow,但这不起作用.

java xml android tablelayout

0
推荐指数
1
解决办法
3690
查看次数

在ScrollView中拉伸TableLayout

我有这个TableLayout:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout" android:layout_height="fill_parent"
android:layout_alignParentBottom="true" android:scrollbars="horizontal|vertical"
android:layout_width="fill_parent" android:scrollbarStyle="outsideInset">
<HorizontalScrollView android:id="@+id/horizontalView" android:layout_height="fill_parent"
            android:layout_width="fill_parent">
    <TableLayout android:id="@+id/reportTableLayout"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:stretchColumns="1">
    </TableLayout>
</HorizontalScrollView>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

我已将所有layout_width设置为fill_parent,但我的Table列似乎没有拉伸并填充宽度空间的其余部分.左边还有一个边距,但我希望我的桌子可以伸展整个屏幕宽度.有任何想法吗?谢谢.

user-interface android scrollview tablelayout

0
推荐指数
1
解决办法
3020
查看次数

以XML格式定义布局时以编程方式创建表行

我试图将行添加到我在XML文件中定义的TableLayout.XML文件包含表的标题行.

我可以使用各种教程中的信息很好地添加新行,但是为新行设置布局所需的代码是一个可怕的混乱,并且只要标题行的布局发生变化,维护就好了.

是否可以在仍然在XML中定义行布局的同时为TableLayout创建新行?例如,在XML中定义模板行,在代码中获取它的句柄,然后在需要时克隆模板.

或者是以某种方式完全不同的正确方法?

android tablelayout

0
推荐指数
1
解决办法
4119
查看次数

在Android TableLayout中打印出ArrayList内容

我有这个ArrayList:

 ArrayList<Double> debtList = datasource.debtList;
 ArrayList<Double> feeList = datasource.feeList;
Run Code Online (Sandbox Code Playgroud)

如何在循环中的TableLayout中并排打印出这两个列表(格式无关紧要)?这是布局:

 TableLayout table = (TableLayout) findViewById(R.id.myTableLayout);
Run Code Online (Sandbox Code Playgroud)

android loops arraylist tablelayout

0
推荐指数
1
解决办法
1万
查看次数

如何将两个孩子放入android中的tablelayout中的一个单元格?

你如何把两个孩子放在表格布局I andorid的一个单元格中?甚至是可能的,似乎无法在互联网上找到任何东西.

android tablelayout

0
推荐指数
1
解决办法
1196
查看次数

如何移动到JTextField中的下一个标记

    else if (cmd.equals("five"))
    {
        infixInput.setText("5");
    }
    else if (cmd.equals("six"))
    {
        infixInput.setText("6");
    }
Run Code Online (Sandbox Code Playgroud)

所以我设置了当你按下calc按钮时,数字显示在中缀文本字段上,但是如果我输入5,那么6例如,6只会替换5.我怎么告诉它移动到按下按钮时的空格

java swing jtextfield tablelayout

0
推荐指数
1
解决办法
87
查看次数

如何使用在Outlook中工作的填充框?

我发现自己正在设计电子邮件HTML和CSS,我正在尝试制作一个带有彩色背景的按钮,并在Outlook 2007/2010/2013中使用文本(垂直和水平居中)周围的一些填充

<span style="background: orange;
      padding: 5px 10px;">Foo bar</span>
Run Code Online (Sandbox Code Playgroud)

如何在Outlook中实现?

我怀疑答案涉及一个包含20世纪90年代一些弃用的HTML属性的表.

css outlook html-email tablelayout

0
推荐指数
1
解决办法
3142
查看次数