我想在整个屏幕上填充自定义视图。我用重量,但仍然不工作。 我正在使用以下代码。请有人告诉我解决方案。自定义视图不能填满整个屏幕
<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" />
我已经尝试过了它不工作,但它仍然四面 –
留下空格,则你也应该删除你的线性布局的填充。 – Kuffs
感谢它工作:)请你能详细说明它是如何工作的? –