0
流明/顯示像這樣的文本的一部分:更新父文本時使用隱藏一個textSwither改變
txtDescription.setInAnimation(in);
txtDescription.setOutAnimation(out);
txtDescription.setFactory(new ViewSwitcher.ViewFactory() {
@Override
public View makeView() {
TextView textView = new TextView(ShopContentDetailActivity.this);
textView.setTextColor(getResources().getColor(R.color.NightDark));
return textView;
}
});
並呼籲變革文本此方法:
private void changeDescription() {
if (displayShort)
txtDescription.setText(Html.fromHtml(shortDescription));
else txtDescription.setText(fullDescription);
displayShort = !displayShort;
}
我的問題是當用戶觸摸textSwitcher顯示文本並再次觸摸以隱藏它時,textSwitcher的父視圖(線性佈局)的高度保持爲文本顯示時的高度,而不更改其高度。
如何在更改文本時更新父視圖? (其確定當觸摸顯示全文)
我正要raport問題做谷歌,但我在你的答案出來。 TextViews的初始狀態是indeeed GONE,文本更改後是INVISIBLE。也許它應該反正報道 – murt