我已经在寻找其他问题的答案,但我没有找到或没有看到它,我很感激任何帮助谢谢。
这些是 Log Cat 中显示的错误
E/Trace(1417): error opening trace file: No such file or directory (2)
E/AndroidRuntime(1417): java.lang.RuntimeException: Unable to start activity ComponentInfo{gabrielrojas.com/gabrielrojas.com.primeraventana}: android.view.InflateException: Binary XML file line #7: Error inflating class textview
E/AndroidRuntime(1417): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class textview
机器人清单
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
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"
android:theme="@style/AppTheme" >
<activity
android:name=".PruebaNumero3"
android:label="@string/title_activity_prueba_numero3" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".primeraventana"/>
<activity android:name=".segundaventana" />
</application>
</manifest>
PruebaNumero3.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=".PruebaNumero3" />
<Button android:id="@+id/boton1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Primera_Ventana"/>
<Button
android:id="@+id/boton2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="60dp"
android:text="@string/Segunda_Ventana" />
</RelativeLayout>
PruebaNumero3.java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_prueba_numero3);
// Visualizamos Los botones
Button boton1 = (Button) findViewById(R.id.boton1);
Button boton2 = (Button) findViewById(R.id.boton2);
// Fijamos los eventos que haran ir a las otras actividades
boton1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(PruebaNumero3.this, primeraventana.class);
startActivity(intent);
}} );
boton2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(PruebaNumero3.this, segundaventana.class);
startActivity(intent);
}} );}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_prueba_numero3, menu);
return true;
} } ;
初级冒险.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<textview android:id="@+id/textview1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Escala_Uno"/>
<Button android:id="@+id/boton3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Menú_Principal"/>
</LinearLayout>
初级冒险.java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.primeraventana);
TextView text = (TextView) findViewById(R.id.textview1);
Button boton3 = (Button) findViewById(R.id.boton3);
text.setText(R.string.Escala_Uno);
boton3.setText(R.string.Menú_Principal);
boton3.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
finish();
segundaventana.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<textview android:id="@+id/textview2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Escala_Dos"/>
<Button android:id="@+id/boton4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Menú_Principal"/>
</LinearLayout>
segundaventana.java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.primeraventana);
TextView text = (TextView) findViewById(R.id.textview2);
Button boton4 = (Button) findViewById(R.id.boton4);
text.setText(R.string.Escala_Dos);
boton4.setText(R.string.Menú_Principal);
boton4.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
finish ();