Is there Any way to set the width of the Layout.
Because most of the time it doesn't work?
Is there Any way to set the width of the Layout.
Because most of the time it doesn't work?
Try adding the layout_width
or width
attributes to your layout. Example:
<LinearLayout android:layout_width="100dip" android:layout_height="100dip" />
If you're doing it the XML way you'd use the layout_width attribute:
<LinearLayout
android:layout_width ="100dp"
android:layout_height="wrap_content" />
If you're doing it programatically you'd use the LayoutParams:
LinearLayour ll = new LinearLayout(this);
parentView.addView(ll, new LinearLayout.LayoutParams(100, LayoutParams.WRAP_CONTENT));