Vue qui disparait après ajout d'élément
Bonjour,
J'ai un problème sur lequel je me casse la tete depuis un bon moment. J'ai une vue XML qui comprend 3 linearlayout (MAIN, PARENT et SUB). PARENT et SUB sont un sous menu comme sur l'application facebook ou mappy qui s'affiche en slide.
j'effectue des transitions , je pousse le MAIN a gauche qui dévoile le PARENT. A ce moment la j'insere dans le parent des elements (des relative layout qui contiennent des textview).
Au clic d'un des element du parents, je pousse le PARENT a gauche et le je devoile le sub a l'ecran. mais au moment de remplir mon linearlayout SUB, le main reviens a la totalité de l'ecran ! voici mon code de la fin de la l'animation du SUB ou je remplis celui ci :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| animSub.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationRepeat(Animation animation) {}
@Override
public void onAnimationEnd(Animation animation) {
map_critere_sub.clearAnimation();
map_critere_sub.layout(animParamsSub.left - map_parent_width , animParamsSub.top, animParamsSub.right - map_parent_width, animParamsSub.bottom);
ViewGroup critere_sub = (ViewGroup) parent.findViewById(R.id.critere_sub);
critere_sub.removeAllViews();
RelativeLayout RL = new RelativeLayout(parent);
RL.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 80));
// TextView
TextView TV = new TextView(parent);
RelativeLayout.LayoutParams TV_params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
TV_params.leftMargin = 20;
TV_params.topMargin = 22;
TV.setText("HOLA");
TV.setTextColor(new ColorStateList(
new int[][]{
new int [] {android.R.attr.state_pressed},
new int [] {android.R.attr.state_focused},
new int [] {}
},
new int[]{
Color.parseColor(Criteria.getcolorSection()),
Color.parseColor(Criteria.getcolorSection()),
Color.WHITE
}
));
TV.setTypeface(null, Typeface.BOLD);
RL.addView(TV, TV_params);
map_critere_sub.addView(RL); // SI JE COMMENTE CETTE LIGNE MA VUE NE DISPARAIS PAS
}
}); |
c'est tres important, merci de votre aide !