android - Error in menu design xml -


i applying menu app.

for written following code in xml:

<menu xmlns:android="http://schemas.android.com/apk/res/android">     <!-- single menu item           set id, icon , title each menu item     -->    <item android:id="@+id/menu_search"           android:icon="@drawable/icon_search"           android:title="search" />  </menu> 

i started getting error on line:

<item android:id="@+id/menu_search"               android:icon="@drawable/icon_search"               android:title="search" /> 

error statements:

description resource    path    location    type element type "item" must followed either attribute specifications, ">" or "/>".   activity_login.xml  /messagereader/res/layout   line 6  android xml format problem error: error parsing xml: not well-formed (invalid token)   activity_login.xml  /messagereader/res/layout   line 6  android aapt problem 

edit:(full code)

<menu xmlns:android="http://schemas.android.com/apk/res/android">     <!-- single menu item           set id, icon , title each menu item     -->    <item android:id="@+id/menu_search"           android:title="search" />  </menu>  <scrollview xmlns:android="http://schemas.android.com/apk/res/android"         xmlns:tools="http://schemas.android.com/tools"         android:id="@+id/scrollview1"         android:layout_width="match_parent"         android:layout_height="fill_parent"         android:layout_alignparentleft="true"         android:layout_alignparenttop="true"         android:layout_marginleft="10dp"         android:layout_margintop="10dp"          android:background="@drawable/msngr"          >          <linearlayout             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:orientation="vertical" >              <imageview                 android:id="@+id/imageview2"                 android:layout_width="match_parent"                 android:layout_height="0dip"                 android:layout_weight="0.38"                 android:src="@drawable/logo" />                <textview                 android:id="@+id/view_username"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:text="@string/view_username"                  />              <edittext                 android:id="@+id/txt_username"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:inputtype="textpersonname"                  android:background="@android:drawable/editbox_background"                 >                  <requestfocus />             </edittext>              <textview                 android:id="@+id/view_password"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:layout_margintop="10dp"                 android:text="@string/view_password"                />              <edittext                 android:id="@+id/txt_password"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:ems="10"                 android:inputtype="textpassword"                 />              <button                 android:id="@+id/btn_login"                 android:layout_width="match_parent"                 android:layout_height="50dp"                 android:layout_margintop="10dp"                 android:background="@drawable/login"                 />              <textview                 android:id="@+id/link_to_register"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:layout_margintop="10dp"                 android:gravity="center"                 android:text="@string/link_to_register" />         </linearlayout>      </scrollview> 

you need put menu xml in separate file (menu.xml) , put file in /res/menu folder of project.

and after ca use in

oncreateoptionsmenu(menu menu) method 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -