Android 安卓图像放置距离上边缘太远
这就是我想要实现的目标 这是布局文件包含的内容Android 安卓图像放置距离上边缘太远,android,Android,这就是我想要实现的目标 这是布局文件包含的内容 <LinearLayout 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:orien
<LinearLayout 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:orientation="vertical"
tools:context=".SplashActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_weight="9"
android:background="@drawable/woodentile" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/innoluck"
android:src="@drawable/inno_luck_logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name_user" />
<EditText
android:id="@+id/name_input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="22"
android:inputType="text" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0sp"
android:layout_weight="1"
android:background="@drawable/woodenshadowtile" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0sp"
android:layout_weight="2"
android:background="@drawable/papertile" >
</LinearLayout>
</LinearLayout>
这就是我最终得到的
如何更改布局文件,使图像视图更接近顶部?执行以下操作:
<LinearLayout 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:orientation="vertical"
tools:context=".SplashActivity" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="@drawable/woodentile" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/innoluck"
android:src="@drawable/inno_luck_logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name_user" />
<EditText
android:id="@+id/name_input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="22"
android:inputType="text" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0sp"
android:layout_weight="1"
android:background="@drawable/woodenshadowtile" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0sp"
android:layout_weight="2"
android:background="@drawable/papertile" >
</LinearLayout>
</RelativeLayout>
</LinearLayout>
我使用了
视图
而不是图像视图
,它工作了
<View
android:id="@+id/inno_luck_logo"
android:layout_width="310dp"
android:layout_height="162dp"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:background="@drawable/inno_luck_logo" />