virsir
virsir

Reputation: 15509

What is the difference between android:layout_width and android:width

I do not know the difference between these two attributes and for the height also.

Take a TextView for example, what would happen if I set its layout_width to wrap_content and set its width to 50 dip?

Upvotes: 7

Views: 7197

Answers (2)

GMBrian
GMBrian

Reputation: 927

There is a difference when using it in combination with layout_weight to fill a parent layout.

When using layout_weight on a TextView you need to set android:width to 0dip. Setting android:layout_width to 0dip will not work.

Upvotes: 4

Robby Pond
Robby Pond

Reputation: 73494

There is essentially no difference, only a TextView has the width property also.

TextView.setWidth

Upvotes: 1

Related Questions