Missing button while executing first official Android tutorial -


i following official android tutorial, when start application, obtain

image

instead of getting

button

hereunder main files of sample project

fragment_main.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="horizontal">     <edittext android:id="@+id/edit_message"         android:layout_weight="1"         android:layout_width="0dp"         android:layout_height="wrap_content"         android:hint="@string/edit_message" />     <button         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/button_send" /> </linearlayout> 

strings.xml

<?xml version="1.0" encoding="utf-8"?> <resources>      <string name="app_name">androidtest</string>     <string name="edit_message">enter message</string>     <string name="button_send">send</string>     <string name="action_settings">settings</string>     <string name="title_activity_main">mainactivity</string>   </resources> 

activity_main.xml

<relativelayout 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:paddingbottom="@dimen/activity_vertical_margin"     android:paddingleft="@dimen/activity_horizontal_margin"     android:paddingright="@dimen/activity_horizontal_margin"     android:paddingtop="@dimen/activity_vertical_margin"     tools:context="com.example.androidtest.mainactivity" >      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/edit_message" />  </relativelayout> 

mainactivity.java

package com.example.androidtest;  import android.app.activity; import android.os.bundle; import android.view.menu; import android.view.menuitem;  public class mainactivity extends activity {      @override     protected void oncreate(bundle savedinstancestate)     {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);     }      @override     public boolean oncreateoptionsmenu(menu menu)     {         // inflate menu; adds items action bar if present.         getmenuinflater().inflate(r.menu.main, menu);         return true;     }      @override     public boolean onoptionsitemselected(menuitem item)     {         // handle action bar item clicks here. action bar         // automatically handle clicks on home/up button, long         // specify parent activity in androidmanifest.xml.         int id = item.getitemid();         if (id == r.id.action_settings)         {             return true;         }         return super.onoptionsitemselected(item);     } } 

system details:

  • fedora 20;
  • android 4.4.4;
  • eclipse 4.4;
  • adb

i think never attach fragment activity.

try copy fragment_main.xml activity_main.xml!


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -