2016-08-23 13 views
1

image with space at top of pictureをアンドロイドスタジオの線形レイアウトの上部に配置しようとしています。写真のようにスペースがあります。私はその空間を取り除きたいと思っています。成功なしでいくつかのことを試してみました!誰でも手掛かりを持ってそれを行う方法???おかげ画像を線形レイアウトで画面の上部に合わせる

<?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" /> 

+0

スクリーンショットが正しく追加されていないことを確認してください。 –

+1

問題に関する詳細情報をお知らせください。また、画像が表示されません –

+0

xmlレイアウトに問題はありません画像が白いかどうかを確認してください – Nikhil

答えて

1

は次のようにあなたのImageViewのを使用してください。

1

問題は、幅と高さ、あなたの画像ソースについてすることができます。あなたのXMLにmarginTopはありません。あなたのImageViewandroid:scaleType="fitXY"を追加してみてください。 scaleType="fitXY"はので、それを避けるため、画像をストレッチします追加、

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

あなたの時間Batuhanありがとう!ありがとう!!!!! –

0

ImageViewパラメータの

android:adjustViewBounds="true" 

を追加してみてください:

+0

パラメータ、scaleType = "fitXY"が追加されましたありがとうございました!私は昨日の夜に試して、私のブラウザはとにかく凍結されたので、奇妙なことに感謝アマール! –

関連する問題