Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If the width of the TextView is set to wrap_content, the table cannot be displayed. #466

Open
blankjava opened this issue Dec 8, 2023 · 0 comments

Comments

@blankjava
Copy link

  • Markwon version: {4.6.2}

The width of the TextView is set to wrap_content:

<TextView
            android:id="@+id/text_view"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:lineSpacingExtra="2dip"
            android:padding="@dimen/content_padding_double"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="?android:attr/textColorPrimary"
            tools:text="Hello there" />

The table cannot be displayed:

public class TableCustomizeSample extends MarkwonTextViewSample {
  @Override
  public void render() {
    final String md = "" +
      "| HEADER | HEADER | HEADER |\n" +
      "|:----:|:----:|:----:|\n" +
      "|   测试  |   测试   |   测试   |\n" +
      "|  测试  |   测试   |  测测测12345试测试测试   |\n" +
      "|   测试  |   测试   |   123445   |\n" +
      "|   测试  |   测试   |   (650) 555-1212   |\n" +
      "|   测试  |   测试   |   [link](#)   |\n";

    final Markwon markwon = Markwon.builder(context)
      .usePlugin(TablePlugin.create(builder -> {
        final Dip dip = Dip.create(context);
        builder
          .tableBorderWidth(dip.toPx(2))
          .tableBorderColor(Color.YELLOW)
          .tableCellPadding(dip.toPx(4))
          .tableHeaderRowBackgroundColor(ColorUtils.applyAlpha(Color.RED, 80))
          .tableEvenRowBackgroundColor(ColorUtils.applyAlpha(Color.GREEN, 80))
          .tableOddRowBackgroundColor(ColorUtils.applyAlpha(Color.BLUE, 80));
      }))
      .build();

    markwon.setMarkdown(textView, md);
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant