我想开发我的应用程序的界面,我应该添加图像按钮(地图,导航,信息,时间测量,搜索)和显示两个按钮的选项菜单('about'&'exit' )...帮助我创建这样的界面...当我在资源drawable-hdpi文件夹中添加图像时,在java文件中显示错误,指出“R无法解析为变量” 以下是java文件的代码
package com.example.margallahillshikedroid;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.Button;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); //error appears here"R can not be resolved into a variable"
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
return true;
}
}
logcat如下;
[2014-03-29 07:59:56 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon- small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 07:59:56 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 07:59:56 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 07:59:56 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 07:59:56 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 07:59:56 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 07:59:56 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 07:59:56 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 07:59:56 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 07:59:56 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 07:59:56 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\layout\activity_main.xml:1: error: Error: String types not allowed (at 'layout_height' with value 'wrap content').
[2014-03-29 07:59:56 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\drawable-hdpi\button_img.xml:4: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/ic_action_search').
[2014-03-29 07:59:56 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\drawable-hdpi\button_img.xml:5: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/ic_action_search').
[2014-03-29 08:00:05 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:05 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:05 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:05 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:05 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:05 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:05 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:05 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:05 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:05 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:05 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\layout\activity_main.xml:1: error: Error: String types not allowed (at 'layout_height' with value 'wrap content').
[2014-03-29 08:00:05 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\drawable-hdpi\button_img.xml:4: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/ic_action_search').
[2014-03-29 08:00:05 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\drawable-hdpi\button_img.xml:5: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/ic_action_search').
[2014-03-29 08:00:45 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:45 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:45 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:45 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:45 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:45 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:45 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:45 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:45 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:45 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:00:45 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\layout\activity_main.xml:1: error: Error: String types not allowed (at 'layout_height' with value 'wrap content').
[2014-03-29 08:00:45 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\drawable-hdpi\button_img.xml:4: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/ic_action_search').
[2014-03-29 08:00:45 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\drawable-hdpi\button_img.xml:5: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/ic_action_search').
[2014-03-29 08:01:29 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:01:29 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:01:29 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:01:29 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:01:29 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:01:29 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:01:29 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:01:29 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:01:29 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:01:29 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:01:29 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\layout\activity_main.xml:1: error: Error: String types not allowed (at 'layout_height' with value 'wrap content').
[2014-03-29 08:01:29 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\drawable-hdpi\button_img.xml:4: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/ic_action_search').
[2014-03-29 08:01:29 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\drawable-hdpi\button_img.xml:5: error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/ic_action_search').
[2014-03-29 08:03:41 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:41 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:41 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:41 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:41 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:41 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:41 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:41 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:41 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:41 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:41 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\layout\activity_main.xml:1: error: Error: String types not allowed (at 'layout_height' with value 'wrap content').
[2014-03-29 08:03:48 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:48 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:48 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:48 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:48 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:48 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:48 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:48 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:48 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:48 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:03:48 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\layout\activity_main.xml:1: error: Error: String types not allowed (at 'layout_height' with value 'wrap content').
[2014-03-29 08:04:18 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:18 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:18 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:18 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:18 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:18 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:18 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:18 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:18 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:18 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Inval id file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:18 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\layout\activity_main.xml:1: error: Error: String types not allowed (at 'layout_height' with value 'wrap content').
[2014-03-29 08:04:28 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:28 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:28 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:28 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:28 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:28 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:28 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:28 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:28 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:28 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:28 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\layout\activity_main.xml:1: error: Error: String types not allowed (at 'layout_height' with value 'wrap content').
[2014-03-29 08:04:35 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:35 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:35 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:35 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:35 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:35 - MargallaHillsHikedroid] res\drawable-hdpi\Google-Maps-app-icon-small.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:35 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:35 - MargallaHillsHikedroid] res\drawable-hdpi\Search-icon.png: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:35 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:35 - MargallaHillsHikedroid] res\drawable-hdpi\alarm-clock-icon_small.jpg: Invalid file name: must contain only [a-z0-9_.]
[2014-03-29 08:04:35 - MargallaHillsHikedroid] E:\my android projects\MargallaHillsHikedroid\res\layout\activity_main.xml:1: error: Error: String types not allowed (at 'layout_height' with value 'wrap content').
//please tell me how to develop the interface with all those buttons and option menu...if you see the menu of 'map factor' android app ....mine's app menu interface should look exactly alike....