0
我尝试设置一个图像到我的android应用程序的最顶端。如何将图像设置为应用程序的顶部?
但是,即使边距为零,左/右/上也总是有空间。
代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:layout_marginBottom="0dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:background="@drawable/bgColor"
android:gravity="top"
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" >
<LinearLayout
android:id="@+id/topBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:src="@drawable/ic_launcher" />
哪里是我的错误? 感谢=)
您的布局中有填充,它将通过'@ dimen/activity_vertical_margin'在其周围添加空格 – Mike 2014-10-07 21:18:31