Reputation: 11
I want to fill my custom view on whole screen. i used weight but still not working. I am using following code. please some one tell me solution.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<com.alarm_animation.CustomeView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#ffffff" />
Upvotes: 0
Views: 903
Reputation: 717
Alter you layout file like this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back"
tools:context=".MainActivity" >
<com.alarm_animation.CustomeView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff" />
Upvotes: 0
Reputation: 16526
Try setting up your custom view like this.-
<com.alarm_animation.CustomeView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff" />
Upvotes: 0
Reputation: 35661
Use match_parent not wrap_content on your custom view.
Remove layout_weight. It is not needed in this situation.
Upvotes: 1