android words not fitting into cells

问题: I'm designing a Sudoku that works with a list of words instead of numbers. For the layout I've used constraintLayout. I'm facing an issue, however when a word is too big to...

问题:

I'm designing a Sudoku that works with a list of words instead of numbers. For the layout I've used constraintLayout. I'm facing an issue, however when a word is too big to fit into a cell. Any idea how can I fix that? p.s sorry first time posting here. So not sure if I'm doing it the right way.

screenshot of the app


回答1:

You can use this library in order to make your text automatically resize and fit the view.
By using this library you don't have to worry about when to change the text size and if it will fit to the view or not.

Here is how to use is:

1) Add dependencies to grade:

implementation 'me.grantland:autofittextview:0.2.1'

2) Add your textView into your layout:

 <me.grantland.widget.AutofitTextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:singleLine="true"
    android:textSize="12sp"
    app:minTextSize="8sp" />
  • 发表于 2019-03-05 12:30
  • 阅读 ( 190 )
  • 分类:sof

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除