Change LinearLayout width in DrawerLayout?



How can I change params of a LinearLayout inside a DrawerLayout?


I've tried it with:



LinearLayout linearLayout;


after onCreate:



drawerLinearLayout = (LinearLayout)findViewById(R.id.drawer);

// drawer is the id of the linearlayout, where I want to change its params

DrawerLayout.LayoutParams lp = new DrawerLayout.LayoutParams(100,100);
linearLayout.setLayoutParams(lp);


the xml is like:



<android.support.v4.widget.DrawerLayout
xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".Main" />

<LinearLayout
android:id="@+id/drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:orientation="vertical">

<ListView
android:id="@+id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>

</android.support.v4.widget.DrawerLayout>


There is no error, but the size of drawer is not 100 x 100 - it takes the whole width and heigth :S


No comments:

Post a Comment