我正在尝试将图像image with space at top of picture对齐到android studio中的线性布局的顶部。我有一个可以在图片上看到的空间。我想摆脱那个空间。尝试了几件事没有成功!!!任何人都有线索怎么做???谢谢

<?xml version="1.0" encoding="utf-8"?>
<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="com.bourgeois.michel.relativesinglescreenapp.MainActivity">

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/topLinear"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

      <ImageView
        android:id="@+id/toppicture"
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:src="@drawable/danielarias" />

    <TextView
        android:id="@+id/phone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="10dp"
        android:textColor="#ff6600"
        android:textStyle="bold"
        android:paddingLeft="10dp"
        android:text="Phone"/>


    <TextView
        android:id="@+id/number"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="10dp"
        android:textColor="#000"
        android:textStyle="normal"
        android:text="424-278-8938"/>


    <View
        android:id="@+id/line"
        android:layout_width="fill_parent"
        android:layout_height="2dp"
        android:layout_marginTop="2dp"
        android:layout_marginBottom="10dp"
        android:background="#ff6600"/>
     </LinearLayout>

     <LinearLayout mlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">



    <TextView
        android:id="@+id/address"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/text"
        android:paddingBottom="20dp"
        android:paddingLeft="10dp"
        android:textColor="#000"
        android:textStyle="bold"
        android:text="Address: 5867 W 3rd St, Los Angeles, CA 90036"

        />

    <TextView
        android:id="@+id/text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/button"
        android:fontFamily="sans-serif-condensed"
        android:paddingBottom="1dp"
        android:textAlignment="center"
        android:textColor="#000"
        android:textSize="16sp"
        android:text="Learn How To Dance Milonguero Tango Style!"/>

    <TextView
        android:id="@+id/thursday"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fontFamily="sans-serif-condensed"
        android:paddingBottom="5dp"
        android:textAlignment="center"
        android:textColor="#000"
        android:textSize="16sp"
        android:text="Every Thursday Night"/>
    <TextView
        android:id="@+id/hour"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fontFamily="sans-serif-condensed"
        android:paddingBottom="5dp"
        android:textAlignment="center"
        android:textColor="#000"
        android:textSize="16sp"
        android:text=" 8:30pm to 9:30pm"/>

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginBottom="15dp"
        android:text="Join Us" />

最佳答案

像这样使用ImageView:

<ImageView
    android:layout_width="match_parent"
    android:layout_height="300dp"
    android:scaleType="fitXY"/>

关于android - 将 ImageView 以线性布局对齐到屏幕顶部,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39096112/

10-09 01:30
查看更多