2
@Override
public boolean onOptionsItemSelected(MenuItem item) {
RelativeLayout screen = (RelativeLayout) findViewById(R.id.RelativeLayout01);
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
switch (item.getItemId()) {
case R.id.menu_control: {
inflater.inflate(R.layout.adv_video, screen, true);
adapter = new ArrayAdapter<String>(screen.getContext(), R.id.spinner1, new String[]{"Author","ISBN","Keyword","Title"});
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner = (Spinner) screen.findViewById(R.id.spinner1);
spinner.setAdapter(adapter);
進一步在代碼按鈕,edittext等如果評論spinner.setAdapter(adapter);
- 一切正常,與空的微調列表。
這裏的日誌:
logcat:
11-02 14:02:01.735: E/AndroidRuntime(1865): FATAL EXCEPTION: main
11-02 14:02:01.735: E/AndroidRuntime(1865): android.content.res.Resources$NotFoundException: Resource ID #0x7f06000e type #0x12 is not valid
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.content.res.Resources.loadXmlResourceParser(Resources.java:1874)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.content.res.Resources.getLayout(Resources.java:731)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:332)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.AbsSpinner.onMeasure(AbsSpinner.java:192)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.View.measure(View.java:8173)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1015)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.TableRow.measureChildBeforeLayout(TableRow.java:243)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:699)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.TableRow.onMeasure(TableRow.java:112)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.View.measure(View.java:8173)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1015)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.LinearLayout.measureVertical(LinearLayout.java:384)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.LinearLayout.onMeasure(LinearLayout.java:307)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.View.measure(View.java:8173)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1015)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:699)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.LinearLayout.onMeasure(LinearLayout.java:309)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.View.measure(View.java:8173)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:581)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:365)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.View.measure(View.java:8173)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.View.measure(View.java:8173)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.View.measure(View.java:8173)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.os.Handler.dispatchMessage(Handler.java:99)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.os.Looper.loop(Looper.java:123)
11-02 14:02:01.735: E/AndroidRuntime(1865): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-02 14:02:01.735: E/AndroidRuntime(1865): at java.lang.reflect.Method.invokeNative(Native Method)
11-02 14:02:01.735: E/AndroidRuntime(1865): at java.lang.reflect.Method.invoke(Method.java:521)
11-02 14:02:01.735: E/AndroidRuntime(1865): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-02 14:02:01.735: E/AndroidRuntime(1865): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-02 14:02:01.735: E/AndroidRuntime(1865): at dalvik.system.NativeStart.main(Native Method)
11-02 14:02:01.743: W/ActivityManager(1306): Force finishing activity de.mjpegsample/.MjpegSample
請從logcat發佈日誌... –
您應該將此更改爲特定問題,而不是僅發佈錯誤日誌。 – Boeckm