Android:布局问题,模拟器中的布局与预览不同

时间:2014-12-31 17:26:42

标签: android xml android-layout layout

我正在使用android studio,但我不知道为什么它会在模拟器中显示不同的布局。所以我想在我的布局中使用操作栏,但在模拟器中只显示空白布局。

布局XML代码:

<?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"
    android:id="@+id/listToDo"
    android:weightSum="1">

 <ListView
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:id="@+id/list">

     </ListView>

menu xml:

    <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">


<item android:id ="@+id/home"
      android:title ="home"
       android:orderInCategory="100"
        app:showAsAction ="ifRoom"/>

<item android:id="@+id/delete"
    android:title="clear all"
    android:orderInCategory="101"
    app:showAsAction="ifRoom"/>

    </menu>

在预览中,它显示了我想要的布局。我使用Nexus 5作为模拟器

0 个答案:

没有答案
相关问题