Table view giving error below API level 11

江枫思渺然 提交于 2019-12-25 06:15:34

问题


I am trying to generate a dynamic table problematically It's working properly above API > 11 but its showing some error like this

05-06 12:35:30.303: E/AndroidRuntime(386): FATAL EXCEPTION: main
05-06 12:35:30.303: E/AndroidRuntime(386): java.lang.NoClassDefFoundError: android.app.ActionBar$LayoutParams
05-06 12:35:30.303: E/AndroidRuntime(386):  at com.ica.icacounselor.Follow_ups_list_third_level.populateTable(Follow_ups_list_third_level.java:105)
05-06 12:35:30.303: E/AndroidRuntime(386):  at com.ica.icacounselor.Follow_ups_list_third_level.onCreate(Follow_ups_list_third_level.java:65)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.os.Looper.loop(Looper.java:123)
05-06 12:35:30.303: E/AndroidRuntime(386):  at android.app.ActivityThread.main(ActivityThread.java:3683)
05-06 12:35:30.303: E/AndroidRuntime(386):  at java.lang.reflect.Method.invokeNative(Native Method)
05-06 12:35:30.303: E/AndroidRuntime(386):  at java.lang.reflect.Method.invoke(Method.java:507)
05-06 12:35:30.303: E/AndroidRuntime(386):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-06 12:35:30.303: E/AndroidRuntime(386):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-06 12:35:30.303: E/AndroidRuntime(386):  at dalvik.system.NativeStart.main(Native Method)

My code follows

    //--------------------------------------------------------------------------------------------------
    // Creating Table Header
    //--------------------------------------------------------------------------------------------------

    TableRow followup_tr_head = new TableRow(this);
    followup_tr_head.setId(10);
    followup_tr_head.setBackgroundResource(R.drawable.list_header);
    followup_tr_head.setLayoutParams(new LayoutParams(
            LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT));


    final TextView time_name_title = new TextView(this);
    time_name_title.setId(20);
    time_name_title.setText("Time");
    time_name_title.setTextColor(Color.WHITE);
    time_name_title.setPadding(5,5,5,5);
    followup_tr_head.addView(time_name_title);// add the column to the table row here
    time_name_title.setTextSize(12);    

    final TextView student_name_title = new TextView(this);
    student_name_title.setId(20);
    student_name_title.setText("Student Name");
    student_name_title.setTextColor(Color.WHITE);
    student_name_title.setPadding(5,5,5,5);
    followup_tr_head.addView(student_name_title);// add the column to the table row here
    student_name_title.setTextSize(12);    

回答1:


the ActionBar is presented in API 11. You can't use it in lower API levels.




回答2:


Yes you can't use ActionBar below API level 11. To use actionbar in lower api levels use ActionBarSherlock




回答3:


I had imported import android.app.ActionBar.LayoutParams;

I should import android.widget.TableRow.LayoutParams;



来源:https://stackoverflow.com/questions/16393962/table-view-giving-error-below-api-level-11

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!