2014-04-03 2 views
5

Google에서 제공 한 탐색 창을 http://developer.android.com/training/implementing-navigation/nav-drawer.html#top에 구현하고 싶습니다.Android - Android 2.2에서 내비게이션 서랍 구현 +

그래서 샘플을 다운로드하고 v7 지원 라이브러리의 appcompat 라이브러리를 사용했습니다.

MainActivity의 활동이 ActionBarActivity를 확장하도록 변경되었습니다. 은 그리고 (에서 getSupportFragmentManager()에 getActionBar() ---> getSupportActionBar(), getFragmentmanger())의 지원 라이브러리 동등한에 11 분 API 레벨을 요구하는 오류를주고 있었다 모든 변경

하지만 지금 내 응용 프로그램에서 충돌한다 첫 번째 줄은 onCreate() 메서드의 super.onCreate(savedInstanceState);입니다.

나는 그것이 나에게 소스를 찾을 수 없습니다하는 오류를 제공 디버깅하려고

과는 ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1953

import java.util.Locale; 

import android.support.v7.app.ActionBarActivity; 

import android.app.Activity; 
import android.support.v4.app.Fragment; 
import android.support.v4.app.FragmentManager; 
import android.app.SearchManager; 
import android.content.Intent; 
import android.content.res.Configuration; 
import android.os.Bundle; 
import android.support.v4.app.ActionBarDrawerToggle; 
import android.support.v4.view.GravityCompat; 
import android.support.v4.widget.DrawerLayout; 
import android.view.LayoutInflater; 
import android.view.Menu; 
import android.view.MenuInflater; 
import android.view.MenuItem; 
import android.view.View; 
import android.view.ViewGroup; 
import android.widget.AdapterView; 
import android.widget.ArrayAdapter; 
import android.widget.ImageView; 
import android.widget.ListView; 
import android.widget.Toast; 

/** 
* This example illustrates a common usage of the DrawerLayout widget 
* in the Android support library. 
* <p/> 
* <p>When a navigation (left) drawer is present, the host activity should detect presses of 
* the action bar's Up affordance as a signal to open and close the navigation drawer. The 
* ActionBarDrawerToggle facilitates this behavior. 
* Items within the drawer should fall into one of two categories:</p> 
* <p/> 
* <ul> 
* <li><strong>View switches</strong>. A view switch follows the same basic policies as 
* list or tab navigation in that a view switch does not create navigation history. 
* This pattern should only be used at the root activity of a task, leaving some form 
* of Up navigation active for activities further down the navigation hierarchy.</li> 
* <li><strong>Selective Up</strong>. The drawer allows the user to choose an alternate 
* parent for Up navigation. This allows a user to jump across an app's navigation 
* hierarchy at will. The application should treat this as it treats Up navigation from 
* a different task, replacing the current task stack using TaskStackBuilder or similar. 
* This is the only form of navigation drawer that should be used outside of the root 
* activity of a task.</li> 
* </ul> 
* <p/> 
* <p>Right side drawers should be used for actions, not navigation. This follows the pattern 
* established by the Action Bar that navigation should be to the left and actions to the right. 
* An action should be an operation performed on the current contents of the window, 
* for example enabling or disabling a data overlay on top of the current content.</p> 
*/ 
public class MainActivity extends ActionBarActivity { 
    private DrawerLayout mDrawerLayout; 
    private ListView mDrawerList; 
    private ActionBarDrawerToggle mDrawerToggle; 

    private CharSequence mDrawerTitle; 
    private CharSequence mTitle; 
    private String[] mPlanetTitles; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 

     mTitle = mDrawerTitle = getTitle(); 
     mPlanetTitles = getResources().getStringArray(R.array.planets_array); 
     mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); 
     mDrawerList = (ListView) findViewById(R.id.left_drawer); 

     // set a custom shadow that overlays the main content when the drawer opens 
     mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); 
     // set up the drawer's list view with items and click listener 
     mDrawerList.setAdapter(new ArrayAdapter<String>(this, 
       R.layout.drawer_list_item, mPlanetTitles)); 
     mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); 

     // enable ActionBar app icon to behave as action to toggle nav drawer 
     getSupportActionBar().setDisplayHomeAsUpEnabled(true); 
     getSupportActionBar().setHomeButtonEnabled(true); 

     // ActionBarDrawerToggle ties together the the proper interactions 
     // between the sliding drawer and the action bar app icon 
     mDrawerToggle = new ActionBarDrawerToggle(
       this,     /* host Activity */ 
       mDrawerLayout,   /* DrawerLayout object */ 
       R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ 
       R.string.drawer_open, /* "open drawer" description for accessibility */ 
       R.string.drawer_close /* "close drawer" description for accessibility */ 
       ) { 
      public void onDrawerClosed(View view) { 
       getSupportActionBar().setTitle(mTitle); 
       supportInvalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() 
      } 

      public void onDrawerOpened(View drawerView) { 
       getSupportActionBar().setTitle(mDrawerTitle); 
       supportInvalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() 
      } 
     }; 
     mDrawerLayout.setDrawerListener(mDrawerToggle); 

     if (savedInstanceState == null) { 
      selectItem(0); 
     } 
    } 

    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
     MenuInflater inflater = getMenuInflater(); 
     inflater.inflate(R.menu.main, menu); 
     return super.onCreateOptionsMenu(menu); 
    } 

    /* Called whenever we call invalidateOptionsMenu() */ 
    @Override 
    public boolean onPrepareOptionsMenu(Menu menu) { 
     // If the nav drawer is open, hide action items related to the content view 
     boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList); 
     menu.findItem(R.id.action_websearch).setVisible(!drawerOpen); 
     return super.onPrepareOptionsMenu(menu); 
    } 

    @Override 
    public boolean onOptionsItemSelected(MenuItem item) { 
     // The action bar home/up action should open or close the drawer. 
     // ActionBarDrawerToggle will take care of this. 
     if (mDrawerToggle.onOptionsItemSelected(item)) { 
      return true; 
     } 
     // Handle action buttons 
     switch(item.getItemId()) { 
     case R.id.action_websearch: 
      // create intent to perform web search for this planet 
      Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); 
      intent.putExtra(SearchManager.QUERY, getSupportActionBar().getTitle()); 
      // catch event that there's no activity to handle intent 
      if (intent.resolveActivity(getPackageManager()) != null) { 
       startActivity(intent); 
      } else { 
       Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); 
      } 
      return true; 
     default: 
      return super.onOptionsItemSelected(item); 
     } 
    } 

    /* The click listner for ListView in the navigation drawer */ 
    private class DrawerItemClickListener implements ListView.OnItemClickListener { 
     @Override 
     public void onItemClick(AdapterView<?> parent, View view, int position, long id) { 
      selectItem(position); 
     } 
    } 

    private void selectItem(int position) { 
     // update the main content by replacing fragments 
     Fragment fragment = new PlanetFragment(); 
     Bundle args = new Bundle(); 
     args.putInt(PlanetFragment.ARG_PLANET_NUMBER, position); 
     fragment.setArguments(args); 

     FragmentManager fragmentManager = getSupportFragmentManager(); 
     fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); 

     // update selected item and title, then close the drawer 
     mDrawerList.setItemChecked(position, true); 
     setTitle(mPlanetTitles[position]); 
     mDrawerLayout.closeDrawer(mDrawerList); 
    } 

    @Override 
    public void setTitle(CharSequence title) { 
     mTitle = title; 
     getSupportActionBar().setTitle(mTitle); 
    } 

    /** 
    * When using the ActionBarDrawerToggle, you must call it during 
    * onPostCreate() and onConfigurationChanged()... 
    */ 

    @Override 
    protected void onPostCreate(Bundle savedInstanceState) { 
     super.onPostCreate(savedInstanceState); 
     // Sync the toggle state after onRestoreInstanceState has occurred. 
     mDrawerToggle.syncState(); 
    } 

    @Override 
    public void onConfigurationChanged(Configuration newConfig) { 
     super.onConfigurationChanged(newConfig); 
     // Pass any configuration change to the drawer toggls 
     mDrawerToggle.onConfigurationChanged(newConfig); 
    } 

    /** 
    * Fragment that appears in the "content_frame", shows a planet 
    */ 
    public static class PlanetFragment extends Fragment { 
     public static final String ARG_PLANET_NUMBER = "planet_number"; 

     public PlanetFragment() { 
      // Empty constructor required for fragment subclasses 
     } 

     @Override 
     public View onCreateView(LayoutInflater inflater, ViewGroup container, 
       Bundle savedInstanceState) { 
      View rootView = inflater.inflate(R.layout.fragment_planet, container, false); 
      int i = getArguments().getInt(ARG_PLANET_NUMBER); 
      String planet = getResources().getStringArray(R.array.planets_array)[i]; 

      int imageId = getResources().getIdentifier(planet.toLowerCase(Locale.getDefault()), 
          "drawable", getActivity().getPackageName()); 
      ((ImageView) rootView.findViewById(R.id.image)).setImageResource(imageId); 
      getActivity().setTitle(planet); 
      return rootView; 
     } 
    } 
} 

로그 캣

04-04 00:46:07.531: D/AndroidRuntime(719): Shutting down VM 
04-04 00:46:07.531: W/dalvikvm(719): threadid=1: thread exiting with uncaught exception (group=0x409961f8) 
04-04 00:46:07.730: E/AndroidRuntime(719): FATAL EXCEPTION: main 
04-04 00:46:07.730: E/AndroidRuntime(719): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.slidingmenu/com.example.slidingmenu.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 
04-04 00:46:07.730: E/AndroidRuntime(719): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955) 
04-04 00:46:07.730: E/AndroidRuntime(719): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980) 
04-04 00:46:07.730: E/AndroidRuntime(719): at android.app.ActivityThread.access$600(ActivityThread.java:122) 
04-04 00:46:07.730: E/AndroidRuntime(719): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146) 
04-04 00:46:07.730: E/AndroidRuntime(719): at android.os.Handler.dispatchMessage(Handler.java:99) 
04-04 00:46:07.730: E/AndroidRuntime(719): at android.os.Looper.loop(Looper.java:137) 
04-04 00:46:07.730: E/AndroidRuntime(719): at android.app.ActivityThread.main(ActivityThread.java:4340) 
04-04 00:46:07.730: E/AndroidRuntime(719): at java.lang.reflect.Method.invokeNative(Native Method) 
04-04 00:46:07.730: E/AndroidRuntime(719): at java.lang.reflect.Method.invoke(Method.java:511) 
04-04 00:46:07.730: E/AndroidRuntime(719): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 
04-04 00:46:07.730: E/AndroidRuntime(719): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 
04-04 00:46:07.730: E/AndroidRuntime(719): at dalvik.system.NativeStart.main(Native Method) 
04-04 00:46:07.730: E/AndroidRuntime(719): Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 
04-04 00:46:07.730: E/AndroidRuntime(719): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:108) 
04-04 00:46:07.730: E/AndroidRuntime(719): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:57) 
04-04 00:46:07.730: E/AndroidRuntime(719): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98) 
04-04 00:46:07.730: E/AndroidRuntime(719): at com.example.slidingmenu.MainActivity.onCreate(MainActivity.java:83) 
04-04 00:46:07.730: E/AndroidRuntime(719): at android.app.Activity.performCreate(Activity.java:4465) 
04-04 00:46:07.730: E/AndroidRuntime(719): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 
04-04 00:46:07.730: E/AndroidRuntime(719): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919) 
04-04 00:46:07.730: E/AndroidRuntime(719): ... 11 more 
를 엽니 다

로그 캣 매니페스트

에서 변경을 수행 한 후
04-04 00:57:19.443: E/AndroidRuntime(365): FATAL EXCEPTION: main 
04-04 00:57:19.443: E/AndroidRuntime(365): android.view.InflateException: Binary XML file line #17: Error inflating class <unknown> 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.view.LayoutInflater.createView(LayoutInflater.java:513) 
04-04 00:57:19.443: E/AndroidRuntime(365): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.view.LayoutInflater.inflate(LayoutInflater.java:385) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:332) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.AbsListView.obtainView(AbsListView.java:1315) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.ListView.makeAndAddView(ListView.java:1727) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.ListView.fillDown(ListView.java:652) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.ListView.fillFromTop(ListView.java:709) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.ListView.layoutChildren(ListView.java:1580) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.AbsListView.onLayout(AbsListView.java:1147) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.view.View.layout(View.java:7035) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:767) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.view.View.layout(View.java:7035) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.FrameLayout.onLayout(FrameLayout.java:333) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.view.View.layout(View.java:7035) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1249) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1125) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.LinearLayout.onLayout(LinearLayout.java:1042) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.view.View.layout(View.java:7035) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.FrameLayout.onLayout(FrameLayout.java:333) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.view.View.layout(View.java:7035) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.FrameLayout.onLayout(FrameLayout.java:333) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.view.View.layout(View.java:7035) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.view.ViewRoot.performTraversals(ViewRoot.java:1045) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.os.Handler.dispatchMessage(Handler.java:99) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.os.Looper.loop(Looper.java:123) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.app.ActivityThread.main(ActivityThread.java:4627) 
04-04 00:57:19.443: E/AndroidRuntime(365): at java.lang.reflect.Method.invokeNative(Native Method) 
04-04 00:57:19.443: E/AndroidRuntime(365): at java.lang.reflect.Method.invoke(Method.java:521) 
04-04 00:57:19.443: E/AndroidRuntime(365): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 
04-04 00:57:19.443: E/AndroidRuntime(365): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 
04-04 00:57:19.443: E/AndroidRuntime(365): at dalvik.system.NativeStart.main(Native Method) 
04-04 00:57:19.443: E/AndroidRuntime(365): Caused by: java.lang.reflect.InvocationTargetException 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.TextView.<init>(TextView.java:321) 
04-04 00:57:19.443: E/AndroidRuntime(365): at java.lang.reflect.Constructor.constructNative(Native Method) 
04-04 00:57:19.443: E/AndroidRuntime(365): at java.lang.reflect.Constructor.newInstance(Constructor.java:446) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.view.LayoutInflater.createView(LayoutInflater.java:500) 
04-04 00:57:19.443: E/AndroidRuntime(365): ... 35 more 
04-04 00:57:19.443: E/AndroidRuntime(365): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-mdpi/abc_ic_ab_back_holo_dark.png from drawable resource ID #0x0 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.content.res.Resources.loadDrawable(Resources.java:1714) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.content.res.TypedArray.getDrawable(TypedArray.java:601) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.view.View.<init>(View.java:1885) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.widget.TextView.<init>(TextView.java:327) 
04-04 00:57:19.443: E/AndroidRuntime(365): ... 39 more 
04-04 00:57:19.443: E/AndroidRuntime(365): Caused by: java.io.FileNotFoundException: res/drawable-mdpi/abc_ic_ab_back_holo_dark.png 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.content.res.AssetManager.openNonAssetNative(Native Method) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.content.res.AssetManager.openNonAsset(AssetManager.java:405) 
04-04 00:57:19.443: E/AndroidRuntime(365): at android.content.res.Resources.loadDrawable(Resources.java:1706) 
04-04 00:57:19.443: E/AndroidRuntime(365): ... 42 more 

activity_main.xml

<!-- 
    Copyright 2013 The Android Open Source Project 

    Licensed under the Apache License, Version 2.0 (the "License"); 
    you may not use this file except in compliance with the License. 
    You may obtain a copy of the License at 

     http://www.apache.org/licenses/LICENSE-2.0 

    Unless required by applicable law or agreed to in writing, software 
    distributed under the License is distributed on an "AS IS" BASIS, 
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    See the License for the specific language governing permissions and 
    limitations under the License. 
    --> 


<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. --> 
<android.support.v4.widget.DrawerLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <!-- As the main content view, the view below consumes the entire 
     space available using match_parent in both dimensions. --> 
    <FrameLayout 
     android:id="@+id/content_frame" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

    <!-- android:layout_gravity="start" tells DrawerLayout to treat 
     this as a sliding drawer on the left side for left-to-right 
     languages and on the right side for right-to-left languages. 
     The drawer is given a fixed width in dp and extends the full height of 
     the container. A solid background is used for contrast 
     with the content view. --> 
    <ListView 
     android:id="@+id/left_drawer" 
     android:layout_width="240dp" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:choiceMode="singleChoice" 
     android:divider="@android:color/transparent" 
     android:dividerHeight="0dp" 
     android:background="#111"/> 
</android.support.v4.widget.DrawerLayout> 

drawer_list_item.xml

<!-- 
    Copyright 2013 The Android Open Source Project 

    Licensed under the Apache License, Version 2.0 (the "License"); 
    you may not use this file except in compliance with the License. 
    You may obtain a copy of the License at 

     http://www.apache.org/licenses/LICENSE-2.0 

    Unless required by applicable law or agreed to in writing, software 
    distributed under the License is distributed on an "AS IS" BASIS, 
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    See the License for the specific language governing permissions and 
    limitations under the License. 
    --> 

<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/text1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceListItemSmall" 
    android:gravity="center_vertical" 
    android:paddingLeft="16dp" 
    android:paddingRight="16dp" 
    android:textColor="#fff" 
    android:background="?android:attr/activatedBackgroundIndicator" 
    android:minHeight="?android:attr/listPreferredItemHeightSmall"/> 

fragment_planet.xml

<!-- 
    Copyright 2013 The Android Open Source Project 

    Licensed under the Apache License, Version 2.0 (the "License"); 
    you may not use this file except in compliance with the License. 
    You may obtain a copy of the License at 

     http://www.apache.org/licenses/LICENSE-2.0 

    Unless required by applicable law or agreed to in writing, software 
    distributed under the License is distributed on an "AS IS" BASIS, 
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    See the License for the specific language governing permissions and 
    limitations under the License. 
    --> 

<ImageView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/image" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#000000" 
    android:gravity="center" 
    android:padding="32dp" /> 

답변

5

당신은 테마 Theme.AppCompat를 사용해야합니다.

manifest.xml에서 theme.xml을 업데이트하고 테마를 설정하십시오.

theme.xml :

<!-- Application theme. --> 
<style name="AppTheme" parent="@style/Theme.AppCompat"> 
    <!-- All customizations that are NOT specific to a particular API-level can go here. --> 
</style> 

manifest.xml :

<application 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme"... 

난 당신이 아무도 더 이상 사용하지 않습니다 안드로이드 2.2 : 잊어하는 것이 좋습니다. 그리고 프로젝트를 청소하십시오.

API14 reference에서 android:attr/textAppearanceListItemSmall을 사용할 수 없습니다.

+0

감사합니다. Android 2.2에서 앱이 계속 충돌합니다. 나는 그것에 대한 logcat을 업데이 트했습니다. 도와주세요. –

+0

답을 업데이트했습니다. 확인해주십시오. 문제가 해결 될 경우 알려주십시오. –

+0

내 XML 파일을 업데이트했습니다. logcat에서 오류를 일으키는 파일은 존재하지 않으며 코드에서 참조되는 곳은 어디에도 없습니다. 어떤 제안? –

0

당신이 홀로 테마 또는 무언가를 사용하고 안드로이드 매니페스트를 확인 비슷한? 매니페스트 파일에 액티비티 태그에이를 배치하십시오 :

android:theme="@style/Theme.AppCompat" 
+0

그래, 이제 애플 리케이션은 안드로이드 4.0 이상에서 작동합니다. Android 2.2에서도 여전히 충돌이 발생합니다. ques에서 logcat을 업데이트했습니다. 도와주세요. –

+1

그가 말한 것처럼 kozaxinan 대답을 참조하십시오. –

+0

Holo 참조를 위해 응용 프로그램 manifest 및 styles.xml을 확인하십시오. 이것은 크래시를 일으키는 원인입니다. 04-04 00 : 57 : 19.443 : E/AndroidRuntime (365) : 원인 : java.io.FileNotFoundException : res/drawable-mdpi/abc_ic_ab_back_holo_dark.png –

0

이 문제가 해결되었습니다. 여기 은 입니다. drawer_list_item.xxx

<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@android:id/text1" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:gravity="center_vertical" 
android:paddingLeft="16dp" 
android:paddingRight="16dp" 
android:textColor="#fff" /> 

이 속성을 사용할 수 없습니다. 안드로이드 2.2에서

android:background="?android:attr/activatedBackgroundIndicator" 
android:minHeight="?android:attr/listPreferredItemHeightSmall" 
android:textAppearance="?android:attr/textAppearanceListItemSmall" 
+0

그래, 나는 또한 문제를 해결했다. 그러나 어쨌든 고마워. –