共享数据时更改了文字格式:Android

时间:2017-10-06 08:01:00

标签: java android plaintext

我想以表格格式分享钻石详细信息(纯文本不是HTML

我使用这个library做了这个,但它使用system.out正确打印数据但是当我共享它时,它的格式改变了: enter image description here

以下是我的代码:

  List<String> headersList = Arrays.asList("", "");
                    List<List<String>> rowsList = Arrays.asList(
                            Arrays.asList("Stone Id :", details[0]),
                            Arrays.asList("Lab", details[1]),
                            Arrays.asList("Shape", details[2]),
                            Arrays.asList("Carat", details[3]),
                            Arrays.asList("Clarity-Color", details[4]),
                            Arrays.asList("Cut-Pol-Sym-Flou", details[5]));


                    Board board = new Board(75);
                    Table table = new Table(board, 75, headersList, rowsList);
                    table.invalidate().setGridMode(Table.GRID_NON).setRowsList(rowsList);
                    List<Integer> colWidthsList = Arrays.asList(30, 14);
                    table.setColWidthsList(colWidthsList);
                    Block tableBlock = table.tableToBlocks();
                    board.setInitialBlock(tableBlock);
                    board.build();
                    String preview1 = board.getPreview();
                    System.out.print(preview1);
                    sharingIntent.putExtra(Intent.EXTRA_TEXT,preview1);

1 个答案:

答案 0 :(得分:1)

控制台使用等宽字体,所有字符的宽度都完全相同。但你的观点并没有使用它,所以它看起来搞砸了。

使用等宽字体。

或使用表格格式。也许是一个ListView,每行有两个并排的文本视图,具有固定的宽度。