2016-06-12 37 views
0

我現在編寫一個簡單的功能到我的應用程序。只需看看我的screenshot - 我不知道爲什麼我的標籤每次都在列表視圖後面。你可以幫我嗎?顯示ListView和我的酒吧在一起不起作用

謝謝你的幫助!

問候

listview.xml

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

    <ListView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/listview" 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" /> 

    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:clickable="true" 
     android:src="@android:drawable/ic_input_add" 
     app:layout_anchor="@+id/listview" 
     android:layout_marginLeft="16dp" 
     android:layout_marginRight="16dp" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentEnd="true" 
     android:nestedScrollingEnabled="false" /> 

</RelativeLayout> 

styles.xml

<resources> 

    <!-- Base application theme. --> 
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
     <!-- Customize your theme here. --> 
     <item name="colorPrimary">@color/colorPrimary</item> 
     <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
     <item name="colorAccent">@color/colorAccent</item> 
    </style> 

    <style name="AppTheme.NoActionBar"> 
     <item name="windowActionBar">false</item> 
     <item name="windowNoTitle">true</item> 
    </style> 

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> 

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> 

</resources> 
+0

你可以添加你styles.xml文件? –

+0

我已經添加了styles.xml。希望能幫助你... – AiiDee

+0

你在這個活動的清單文件中設置了哪個主題? –

回答

0
<style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style> 

這導致了在ActionBar去消失,如果你想使用那個主題比你需要增加一個Toolbar到您的佈局文件並將其設置爲ActionBarActivity

對於e.g

setSupportActionBar(yourtoolbar); // add to activity XML file and refer to it using findViewById() as you do with other views