私は最近、R.JAVAを無駄に生成させようとしています。次のことを試しました1.マニフェストファイルにスペースを追加する2.プロジェクト->クリーン
だから私の最後の推測は、I/eclipseが見ることができなかった私のxmlファイルにいくつかのエラーがあるということです。そのため、レビューのためにxmlファイルをチェックできる可能性のある2番目の目が欲しいと思っていました。3つしかないので、かなり基本的なものにする必要があります(Androidブックの紹介をフォローしています)。
マニフェストファイル
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.activites"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Activity2"
android:label="Activity 2" >
<intent-filter>
<action android:name="com.example.ACTIVITY2" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
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" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world"
tools:context=".MainActivity" />
</RelativeLayout>
Activity2.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" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is Activity 2!" />
</RelativeLayout>
私のような初心者を助けるために忙しい昼/夜から時間を割いてくれた皆さんにもう一度感謝します。また、xmlにエラー以外の提案がある場合は、遠慮なくそれらを提示してください。
ここで要求されているように、問題はウィンドウに表示されます->ビューを表示->問題
- Rを変数に解決できません
- Rを変数に解決できません
- Rを変数に解決できません
タグはそれほど明白ではありませんが、次のコード行でcatlogにデバッグ情報を表示するために使用されます。
public class MainActivity extends Activity {
文字列タグ="イベント";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
Log.d(tag, "In the onCreate() event");
}