如何将ActionBarActivity添加到Project工作区中?

时间:2019-07-06 15:38:58

标签: android

我想在我的Android项目中添加ActionbarActivity,因为我想使用android.support.v7.widgets.Gridlayout

我试图在项目结构中创建模块appcompat-v7 鞋子ActionbarActivity符号仍然无法解析

public class MainActivity extends ActionBarActivity {
    public void image(View view){
        GridLayout grid = findViewBYId(R.id.gridlayout);
        ImageView image =  findViewById(R.id.imageView3);
        image.setImageResource(dragon2);
}

如果我使用AppcompatActivity而不是ActionBarActivity 应用程序在
处崩溃 GridLayout grid = findViewBYId(R.id.gridlayout)

遵循一些方法 http://www.androiddocs.com/tools/support-library/features.html [How to add ActionBarActivity in Android Project?

请帮助。

    --------- beginning of crash
2019-07-07 01:51:24.981 9256-9256/com.example.gameconnect3 E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.gameconnect3, PID: 9256
    java.lang.IllegalStateException: Could not execute method for android:onClick
        at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:402)
        at android.view.View.performClick(View.java:7125)
        at android.view.View.performClickInternal(View.java:7102)
        at android.view.View.access$3400(View.java:801)
        at android.view.View$PerformClick.run(View.java:27301)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:214)

0 个答案:

没有答案