有没有办法对TextView
产生这种影响?
google play comment
我尝试使用CompoundDrawable
,但是它没有覆盖TextView
的功能,因此是徒劳的。
public class ExpandableTextView extends AppCompatTextView implements View.OnClickListener {
//rest of the code don't matter
@Override
protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter)
{
/* If text longer than maxLines set DrawableBottom - I'm using '...' icon */
post(new Runnable()
{
public void run()
{
if (getLineCount()> maxLines) {
setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, R.drawable.see_more);
}
else
setCompoundDrawablesWithIntrinsicBounds(0,0,0,0);
ExpandableTextView.super.setMaxLines(maxLines);
}
});
}
}
我什至尝试用.setCompoundDrawable
替换它,并且我使用.setBounds()
带有负值,但仍然没有结果