安卓程序unfortunately, has stopped 怎么处理?

/*这是activity*/

package com.example.test;



import android.app.Activity;

import android.os.Bundle;

import android.view.Menu;



public class MainActivity extends Activity {


    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

    }

    public boolean OnCreateOptionsMenu(Menu menu){

    getMenuInflater().inflate(R.menu.main,menu);

    return true;

    }

}

/*这是方法的重写*/

package com.example.test;


import android.content.Context;

import android.util.AttributeSet;

import android.widget.TextView;


public class GundongText extends TextView{


public GundongText(Context context, AttributeSet attrs, int defStyle) {

super(context, attrs, defStyle);

}


public GundongText(Context context, AttributeSet attrs) {

super(context, attrs);

}


public GundongText(Context context) {

super(context);

}

@Override

public boolean isFocused(){

return true;

}


}

/*这是layout*/

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:id="@+id/container"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    tools:context="com.example.test.MainActivity"

    tools:ignore="MergeRootFrame" >


    <com.exaple.test.GundongText

        android:id="@+id/textView1"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:singleLine="true"

        android:focusable="true"

        android:ellipsize="marquee"

        android:focusableInTouchMode="true"

        android:text="@string/Text" />


    <com.exaple.test.GundongText

        android:layout_below="@+id/textView1"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:ellipsize="marquee"

        android:layout_marginTop="23dp"

        android:focusable="true"

        android:focusableInTouchMode="true"

        android:singleLine="true"

        android:text="@string/Text" />


</RelativeLayout>


Js_Ly
浏览 4369回答 1
1回答

Js_Ly

简单的单词拼写错误
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Android