private boolean moreflag = false;//初始化時給false 根據需求更改
txtMemo = (TextView) this.findViewById(R.id.memo);
txtMemo.setMaxLines(2);//初始化時設定最大行數為2兩行
llyt_More = (LinearLayout) findViewById(R.id.housedetail_llyt_more);
// 更多
btn_More = (Button) findViewById(R.id.housedetail_btn_more);//更多文字
imgView_More = (ImageView) findViewById(R.id.housedetail_imgview_more);// 圖檔 向上 向下
btn_More.setOnClickListener(ocMore);//監聽點選事件
private OnClickListener ocMore = new OnClickListener()
{
@Override
public void onClick(View v)
{
if (moreflag)
{
imgView_More.setImageResource(R.drawable.infomoredown);
txtMemo.setMaxLines(2);
btn_More.setText("更多");
moreflag = false;
}
else
{
imgView_More.setImageResource(R.drawable.infomoreup);
txtMemo.setMaxLines(200);
btn_More.setText("收起");
moreflag = true;
}
}
};
效果圖