vendredi 21 mars 2014

Changing weight of a view programatically


Vote count:

0




I have a View that I defined in an XML layout and I want to change its weight attribute. How do I do that?


I tried though the setLayoutParams() method like:



myView = (View)findViewById(R.id.someView);
myView.setLayoutParams(new View.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 10f));


but it says that View.LayoutParams cannot be resolved to a type



asked 54 secs ago






Aucun commentaire:

Enregistrer un commentaire