Android: layout issues, the layout is different in emulator than in preview



I am using android studio, but I do not know why it is showing the different layout in emulator. So I want an action bar in my layout but in emulator only blank layout is shown.


layout XML Code:



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4" 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://ift.tt/nIICcg"
xmlns:app="http://ift.tt/GEGVYd"
xmlns:tools="http://ift.tt/LrGmb4"
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>


In the preview, it shows the layout that i want to have. I am using Nexus 5 as an emulator


No comments:

Post a Comment