怎么实现TextView的展开与收缩
1个回答
展开全部
给一个boolean值
case R.id.tv_load:
if (mapboolean) {
mapboolean = false;
Drawable draw = getResources().getDrawable(R.drawable.shop_more_arrow);
mTv_load.setCompoundDrawablePadding(4);
mTv_load.setCompoundDrawablesRelativeWithIntrinsicBounds(null,null,draw,null);
mTv_shop_storeIntroduce.setEllipsize(null); // 展开
mTv_shop_storeIntroduce.setSingleLine(mapboolean);
} else {
mapboolean = true;
Drawable draw = getResources().getDrawable(R.drawable.shop_down_xia);
mTv_load.setCompoundDrawablePadding(4);
mTv_load.setCompoundDrawablesRelativeWithIntrinsicBounds(null,null,draw,null);
mTv_shop_storeIntroduce.setEllipsize(TextUtils.TruncateAt.END); // 收缩
}
case R.id.tv_load:
if (mapboolean) {
mapboolean = false;
Drawable draw = getResources().getDrawable(R.drawable.shop_more_arrow);
mTv_load.setCompoundDrawablePadding(4);
mTv_load.setCompoundDrawablesRelativeWithIntrinsicBounds(null,null,draw,null);
mTv_shop_storeIntroduce.setEllipsize(null); // 展开
mTv_shop_storeIntroduce.setSingleLine(mapboolean);
} else {
mapboolean = true;
Drawable draw = getResources().getDrawable(R.drawable.shop_down_xia);
mTv_load.setCompoundDrawablePadding(4);
mTv_load.setCompoundDrawablesRelativeWithIntrinsicBounds(null,null,draw,null);
mTv_shop_storeIntroduce.setEllipsize(TextUtils.TruncateAt.END); // 收缩
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询