複数あるviewのうち、一部のviewのみ更新を行いたいのですが、
setLayoutParamsで更新をおこなってしまうとview全てが更新されてしまいます。
一部だけ更新する場合、どのような方法が良いのでしょうか。
初期配置
al.addView(cards.get(i), new AbsoluteLayout.LayoutParams(
change_dptopx(Card.width),
change_dptopx(Card.height),
width / 10 + change_dptopx(30),
(3 * height / 8) + change_dptopx(Card.height) * 2 / 5
- change_dptopx(30)));
al.addView(cards.get(i), new AbsoluteLayout.LayoutParams(
change_dptopx(Card.width),
change_dptopx(Card.height), width / 10
+ change_dptopx(30), (4 * height / 8)
+ change_dptopx(Card.height) * 2 / 5
- change_dptopx(30)));
al.addView(cards.get(i), new AbsoluteLayout.LayoutParams(
change_dptopx(Card.width),
change_dptopx(Card.height), width / 10
+ change_dptopx(30), (5 * height / 8)
+ change_dptopx(Card.height) * 2 / 5
- change_dptopx(30)));
viewのサイズ変更
public void fixcard() {
if (centerX > 4*app.screen_size_width / 7 + Card.width / 5 && centerX < 4*app.screen_size_width / 7 + Card.width - Card.width / 5 && centerY > ( 1+2) * app.screen_size_height / 8 + change_dptopx(Card.height) * 2 / 5 - change_dptopx(30) && centerY < (1+2) * app.screen_size_height / 8 + change_dptopx(Card.height) * 2 / 5 + Card.height - change_dptopx(30)) { if (main.settable(1)) { Log.d("cardset", "????="+change_dptopx(Card.width)); Log.d("cardset", "width="+width); this.setLayoutParams(new AbsoluteLayout.LayoutParams( 80, 43, 4*1280/7+150, 272));
main.card_set(1, this);
Log.v("set", "space=" + 1);
}
}
else if (centerX > 4*app.screen_size_width / 7 + Card.width / 5 && centerX < 4*app.screen_size_width / 7 + Card.width - Card.width / 5 && centerY > ( 2+2) * app.screen_size_height / 8 + change_dptopx(Card.height) * 2 / 5 - change_dptopx(30) && centerY < (2+2) * app.screen_size_height / 8 + change_dptopx(Card.height) * 2 / 5 + Card.height - change_dptopx(30)) { if (main.settable(2)) { Log.d("cardset", "????="+change_dptopx(Card.width)); Log.d("cardset", "width="+width); Log.d("cardset", "width2="+width); this.setLayoutParams(new AbsoluteLayout.LayoutParams( 160, 85, 4*1280/7, 390));
main.card_set(2, this);
Log.v("cardset", "width2="+width);
Log.v("set", "space=" + 2);
} } else if(centerX > 4*app.screen_size_width / 7 + Card.width / 5 && centerX < 4*app.screen_size_width / 7 + Card.width - Card.width / 5 && centerY > ( 3+2) * app.screen_size_height / 8 + change_dptopx(Card.height) * 2 / 5 - change_dptopx(30) && centerY < (3+2) * app.screen_size_height / 8 + change_dptopx(Card.height) * 2 / 5 + Card.height - change_dptopx(30)) { if (main.settable(3)) { Log.d("cardset", "????="+change_dptopx(Card.width)); Log.d("cardset", "width="+width);
this.setLayoutParams(new AbsoluteLayout.LayoutParams(
480,
85,
4*1280/7,
510));
main.card_set(3, this); Log.v("set", "space=" + 3); } }
あなたの回答
tips
プレビュー