2016-02-12 30 views
1

我已經在我的Android應用程序增加了一個ImageView的。在應用程序標題欄(顯示應用程序名稱的欄)下顯示了一半圖像,而不是顯示在應用程序標題欄下方。這裏是我的代碼:ImageView的顯示,而不是在它下面

<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=".TopLevelActivity"> 


    <ImageView 
     android:layout_width="200dp" 
     android:layout_height="100dp" 
     android:src="@drawable/logo" 
     android:contentDescription="@string/logo" /> 

    <ListView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/list_options" 
     android:entries="@array/options"/> 

回答

0

添加機器人:fitsSystemWindows =「true」以你的LinearLayout

+0

它沒有工作。 :( – dexbyte

0

添加機器人:paddingTop到ImageView的希望這可以幫助你

+0

我已經做到了,但是那只是一個工作,我身邊需要一個適當的修復 – dexbyte

0

我會建議你設置你的主題在清單defiened到:

android:theme="@style/Theme.AppCompat.NoActionBar" 

然後將此代碼添加到您的XML

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="#FAFAFA"> 

<android.support.v7.widget.Toolbar 
    android:id="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="?attr/actionBarSize" 
    android:background="?attr/colorPrimary" 
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
    > 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/title" 
     android:text="Your App Title" 
     android:textSize="25dp" 
     android:textColor="#ffffff" 
     /> 

</android.support.v7.widget.Toolbar> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_below="@+id/toolbar" 
    android:orientation="vertical" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true"> 

    <ImageView 
     android:layout_width="200dp" 
     android:layout_height="100dp" 
     android:src="@drawable/logo" /> 

    <ListView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/list_options" 
     android:entries="@array/options" 
     /> 

</LinearLayout> 

View post on imgur.com

+0

不工作:( – dexbyte

+0

你可以張貼截圖 – Dolan

+0

很抱歉這麼晚纔回復我已上傳的截圖HTTP:?// imgur。 COM/XVgt4XP – dexbyte

相關問題