这是错误:
02-14 02:00:55.663 907-907/com.wlodsgn.bunbunup E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.wlodsgn.bunbunup, PID: 907
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wlodsgn.bunbunup/com.wlodsgn.bunbunup.MenuActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.wlodsgn.bunbunup.MenuActivity.onCreate(MenuActivity.java:81)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
02-14 02:01:01.643 907-907/com.wlodsgn.bunbunup I/Process﹕ Sending signal. PID: 907 SIG: 9
我真的不知道可能是什么问题,花了几个小时试图寻找解决方案,但是它仍然崩溃了。这个想法是让我的第一个主要活动(IntroActivity.java)用导航抽屉打开另一个活动(menuactivity.java)。任何帮助将不胜感激。
这是IntroActivity.java:
import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
/**
* Created by WiLo on 2/13/2015.
*/
public class IntroActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_intro);
Log.i("BunBunUp", "MainActivity Created");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_intro, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void startMenuActivity(View v){
Intent intent = new Intent(IntroActivity.this, MenuActivity.class);
startActivity(intent);
}
protected void onResume(){
super.onResume();
Log.i("BunBunUp", "IntroActivity Resumed");
}
protected void onPause(){
super.onPause();
Log.i("BunBunUp", "IntroActivity Paused");
}
protected void onStop(){
super.onStop();
Log.i("BunBunUp", "IntroActivity Stopped");
}
}
这是MenuActivity.java:
import java.util.ArrayList;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
/**
* Created by WiLo on 2/13/2015.
*/
public class MenuActivity extends Activity {
private DrawerLayout mDrawerLayout;
private ListView mDrawerList;
private ActionBarDrawerToggle mDrawerToggle;
// nav drawer title
private CharSequence mDrawerTitle;
// used to store app title
private CharSequence mTitle;
// slide menu items
private String[] navMenuTitles;
private TypedArray navMenuIcons;
private ArrayList<NavDrawerItem> navDrawerItems;
private NavDrawerListAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
mTitle = mDrawerTitle = getTitle();
// load slide menu items
navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items);
// nav drawer icons from resources
navMenuIcons = getResources()
.obtainTypedArray(R.array.nav_drawer_icons);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerList = (ListView) findViewById(R.id.list_slidermenu);
navDrawerItems = new ArrayList<NavDrawerItem>();
// agregar un nuevo item al menu deslizante
// Favoritos
navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons.getResourceId(0, -1)));
// Pedidos
navDrawerItems.add(new NavDrawerItem(navMenuTitles[1], navMenuIcons.getResourceId(1, -1)));
// Catologo
//navDrawerItems.add(new NavDrawerItem(navMenuTitles[2], navMenuIcons.getResourceId(2, -1), true, "Estrenos"));
// Contacto
//navDrawerItems.add(new NavDrawerItem(navMenuTitles[3], navMenuIcons.getResourceId(3, -1)));
// Recycle the typed array
navMenuIcons.recycle();
mDrawerList.setOnItemClickListener(new SlideMenuClickListener());
// setting the nav drawer list adapter
adapter = new NavDrawerListAdapter(getApplicationContext(),
navDrawerItems);
mDrawerList.setAdapter(adapter);
// enabling action bar app icon and behaving it as toggle button
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setHomeButtonEnabled(true);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.drawable.ic_drawer, //nav menu toggle icon
R.string.app_name, // nav drawer open - description for accessibility
R.string.app_name // nav drawer close - description for accessibility
) {
public void onDrawerClosed(View view) {
getActionBar().setTitle(mTitle);
// calling onPrepareOptionsMenu() to show action bar icons
invalidateOptionsMenu();
}
public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(mDrawerTitle);
// calling onPrepareOptionsMenu() to hide action bar icons
invalidateOptionsMenu();
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
if (savedInstanceState == null) {
// on first time display view for first nav item
displayView(0);
}
}
/**
* Slide menu item click listener
* */
private class SlideMenuClickListener implements
ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
// display view for selected nav drawer item
displayView(position);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// toggle nav drawer on selecting action bar app icon/title
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
// Handle action bar actions click
switch (item.getItemId()) {
case R.id.action_settings:
return true;
default:
return super.onOptionsItemSelected(item);
}
}
/* *
* Called when invalidateOptionsMenu() is triggered
*/
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// if nav drawer is opened, hide the action items
boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
menu.findItem(R.id.action_settings).setVisible(!drawerOpen);
return super.onPrepareOptionsMenu(menu);
}
/**
* Diplaying fragment view for selected nav drawer list item
* */
private void displayView(int position) {
// update the main content by replacing fragments
Fragment fragment = null;
switch (position) {
case 0:
fragment = new FmMenu();
break;
case 1:
fragment = new FmContacto();
break;
default:
break;
}
if (fragment != null) {
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.frame_container, fragment).commit();
// update selected item and title, then close the drawer
mDrawerList.setItemChecked(position, true);
mDrawerList.setSelection(position);
setTitle(navMenuTitles[position]);
mDrawerLayout.closeDrawer(mDrawerList);
} else {
// error in creating fragment
Log.e("Ramiro", "MainActivity - Error cuando se creo el fragment");
}
}
@Override
public void setTitle(CharSequence title) {
mTitle = title;
getActionBar().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);
在回答Simon的问题时,这是我的调试结果:
http://imgur.com/eUbJwur,hNwymAF#0
这些是可变的结果:
this = {com.wlodsgn.bunbunup.MenuActivity@831912707472}
adapter = {com.wlodsgn.bunbunup.NavDrawerListAdapter@831912476752}
mDrawerLayout = {android.support.v4.widget.DrawerLayout@831912722552}"android.support.v4.widget.DrawerLayout{b1dcc078 VFE..... ......I. 0,0-0,0 #7f090042 app:id/drawer_layout}"
mDrawerList = {android.widget.ListView@831912773352}"android.widget.ListView{b1dd86e8 VFED.VC. ......I. 0,0-0,0 #7f090044 app:id/list_slidermenu}"
mDrawerTitle = {java.lang.String@831912705496}"Menu"
mDrawerToggle = null
mTitle = {java.lang.String@831912705496}"Menu"
navDrawerItems = {java.util.ArrayList@831912670472} size = 2
navMenuIcons = {android.content.res.TypedArray@831912712688}"[3, 77, 2, 2130837561, 0, 160, 3, 73, 2, 2130837559, 0, 160, 3, 72, 2, 2130837560, 0, 160, 3, 76, 2, 2130837556, 0, 160, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, -1, 0, 0, 0, ...
navMenuTitles = {java.lang.String[4]@831912431488}
mActionBar = null
mActivityInfo = {android.content.pm.ActivityInfo@831912705176}"ActivityInfo{b1dc7c98 com.wlodsgn.bunbunup.MenuActivity}"
mAllLoaderManagers = null
mApplication = {android.app.Application@831912467056}
mWindowManager = {android.view.WindowManagerImpl@831912710184}
mWindow = {com.android.internal.policy.impl.PhoneWindow@831912708664}
mUiThread = {java.lang.Thread@831908953256}"Thread[main,5,main]"
mTranslucentCallback = null
mComponent = {android.content.ComponentName@831912704936}"ComponentInfo{com.wlodsgn.bunbunup/com.wlodsgn.bunbunup.MenuActivity}"
mToken = {android.os.BinderProxy@831912705080}
mContainer = {android.app.Activity$1@831912707880}
mCurrentConfig = {android.content.res.Configuration@831912708528}"{1.0 310mcc260mnc en_US ldltr sw360dp w360dp h567dp 480dpi nrml port finger qwerty/v/v -nav/h s.5}"
mDecor = null
mTitle = {java.lang.String@831912705496}"Menu"
mDefaultKeySsb = null
mSearchManager = null
mResultData = null
mEmbeddedID = null
mParent = null
mMenuInflater = null
mFragments = {android.app.FragmentManagerImpl@831912707760}"FragmentManager{b1dc86b0 in MenuActivity{b1dc8590}}"
mHandler = {android.os.Handler@831912708008}"Handler (android.os.Handler) {b1dc87a8}"
mManagedDialogs = null
mInstanceTracker = {android.os.StrictMode$InstanceTracker@831912707920}
mInstrumentation = {android.app.Instrumentation@831912463176}
mIntent = {android.content.Intent@831912704784}"Intent { cmp=com.wlodsgn.bunbunup/.MenuActivity }"
mLastNonConfigurationInstances = null
mLoaderManager = null
mManagedCursors = {java.util.ArrayList@831912707896} size = 0
mMainThread = {android.app.ActivityThread@831912436760}
mLoadersStarted = false
mIdent = -1308749784
mFinished = false
mEnableDefaultActionBarUp = false
mResultCode = 0
mDoReportFullyDrawn = true
mResumed = false
mDestroyed = false
mStartedActivity = false
mStopped = false
mTemporaryPause = false
mDefaultKeyMode = 0
mTitleColor = 0
mTitleReady = false
mConfigChangeFlags = 0
mCheckedForLoaderManager = false
mChangingConfigurations = false
mVisibleFromClient = true
mVisibleFromServer = false
mChangeCanvasToTranslucent = false
mWindowAdded = false
mCalled = true
mBase = {android.app.ContextImpl@831912708040}
mInflater = {com.android.internal.policy.impl.PhoneLayoutInflater@831912709768}
mOverrideConfiguration = null
mResources = {android.content.res.Resources@831912458488}
mTheme = {android.content.res.Resources$Theme@831912710208}
mThemeResource = 2131492864
mBase = {android.app.ContextImpl@831912708040}
savedInstanceState = null
mDrawerList = {android.widget.ListView@831912773352}"android.widget.ListView{b1dd86e8 VFED.VC. ......I. 0,0-0,0 #7f090044 app:id/list_slidermenu}"
mTempRect = {android.graphics.Rect@831912490576}"Rect(0, 0 - 0, 0)"
mArrowScrollFocusResult = {android.widget.ListView$ArrowScrollFocusResult@831912688680}
mDivider = {android.graphics.drawable.ColorDrawable@831912513672}
mOverScrollHeader = null
mOverScrollFooter = null
mDividerPaint = null
mFocusSelector = null
mHeaderViewInfos = {java.util.ArrayList@831912694584} size = 0
mFooterViewInfos = {java.util.ArrayList@831912689696} size = 0
mHeaderDividersEnabled = true
mFooterDividersEnabled = true
mIsCacheColorOpaque = false
mItemsCanFocus = false
mDividerIsOpaque = true
mDividerHeight = 3
mAreAllItemsSelectable = true
mAccessibilityDelegate = null
mVelocityTracker = null
mAdapter = {com.wlodsgn.bunbunup.NavDrawerListAdapter@831912476752}
mTouchModeReset = null
mTouchFrame = null
mTextFilter = null
mSelectorRect = {android.graphics.Rect@831912543968}"Rect(0, 0 - 0, 0)"
mCheckStates = {android.util.SparseBooleanArray@831912575600}"{}"
mCheckedIdStates = null
mSelector = {android.graphics.drawable.StateListDrawable@831912745608}
mChoiceActionMode = null
mScrollUp = null
mClearScrollingCache = null
mContextMenuInfo = null
mDataSetObserver = {android.widget.AbsListView$AdapterDataSetObserver@831912473520}
mDefInputConnection = null
mScrollStrictSpan = null
mScrollDown = null
mRemoteAdapter = null
mRecycler = {android.widget.AbsListView$RecycleBin@831912464376}
mEdgeGlowBottom = {android.widget.EdgeEffect@831912768272}
mEdgeGlowTop = {android.widget.EdgeEffect@831912774568}
mPublicInputConnection = null
mPositionScroller = null
mFastScroller = null
mPositionScrollAfterLayout = null
mPopup = null
mPerformClick = null
mFlingRunnable = null
mFlingStrictSpan = null
mPendingSync = null
mPendingCheckForTap = null
mPendingCheckForLongPress = null
mPendingCheckForKeyLongPress = null
mOwnerThread = {java.lang.Thread@831908953256}"Thread[main,5,main]"
mIsScrap = {boolean[1]@831912700520}
mOnScrollListener = null
mMultiChoiceModeCallback = null
mListPadding = {android.graphics.Rect@831912509624}"Rect(0, 0 - 0, 0)"
mLastPositionDistanceGuess = 0
mLastScrollState = 0
mLastTouchMode = -1
mLastY = 0
mLayoutMode = 0
mLastHandledItemCount = 0
mMaximumVelocity = 24000
mMinimumVelocity = 150
mMotionCorrection = 0
mMotionPosition = 0
mMotionViewNewTop = 0
mMotionViewOriginalTop = 0
mMotionX = 0
mMotionY = 0
mLastAccessibilityScrollEventToIndex = 0
mLastAccessibilityScrollEventFromIndex = 0
mOverflingDistance = 18
mOverscrollDistance = 0
mOverscrollMax = 0
mIsChildViewEnabled = false
mGlowPaddingRight = 0
mGlowPaddingLeft = 0
mGlobalLayoutListenerAddedFilter = false
mForceTranscriptScroll = false
mFlingProfilingStarted = false
mFirstPositionDistanceGuess = 0
mPopupHidden = false
mFiltered = false
mFastScrollEnabled = false
mFastScrollAlwaysVisible = false
mDrawSelectorOnTop = false
mDirection = 0
mResurrectToPosition = -1
mDensityScale = 3.0
mScrollProfilingStarted = false
mDeferNotifyDataSetChanged = false
mChoiceMode = 1
mScrollingCacheEnabled = true
mSelectedTop = 0
mSelectionBottomPadding = 0
mSelectionLeftPadding = 0
mSelectionRightPadding = 0
mSelectionTopPadding = 0
mCheckedItemCount = 0
mSelectorPosition = -1
mCachingStarted = false
mSmoothScrollbarEnabled = true
mStackFromBottom = false
mCachingActive = false
mTextFilterEnabled = false
mCacheColorHint = 0
mTouchMode = -1
mAdapterHasStableIds = false
mTouchSlop = 24
mTranscriptMode = 0
mVelocityScale = 1.0
mActivePointerId = -1
mWidthMeasureSpec = 0
mSelectionNotifier = null
mOnItemSelectedListener = null
mOnItemLongClickListener = null
mOnItemClickListener = {com.wlodsgn.bunbunup.MenuActivity$SlideMenuClickListener@831912422512}
mEmptyView = null
mSyncRowId = -9223372036854775808
mSyncHeight = 0
mSelectedRowId = -9223372036854775808
mOldSelectedRowId = -9223372036854775808
mNextSelectedRowId = -9223372036854775808
mNextSelectedPosition = -1
mNeedSync = false
mOldItemCount = 0
mOldSelectedPosition = -1
mLayoutHeight = 0
mDesiredFocusableState = true
mDesiredFocusableInTouchModeState = true
mDataChanged = false
mSelectedPosition = -1
mItemCount = 2
mBlockLayoutRequests = false
mSpecificTop = 0
mInLayout = false
mSyncMode = 0
mSyncPosition = 0
mFirstPosition = 0
mAnimationListener = null
mCachePaint = null
mVisibilityChangingChildren = null
mTransitioningViews = null
mChildTransformation = null
mChildren = {android.view.View[12]@831912500288}
mTransition = null
mCurrentDrag = null
mCurrentDragView = null
mDisappearingChildren = null
mDragNotifiedChildren = null
mFirstHoverTarget = null
mFirstTouchTarget = null
mFocused = null
mOnHierarchyChangeListener = null
mLocalPoint = null
mInvalidateRegion = null
mInvalidationTransformation = null
mLayoutTransitionListener = {android.view.ViewGroup$3@831912441104}
mLayoutAnimationController = null
mLastTouchDownX = 0.0
mLastTouchDownTime = 0
mLastTouchDownY = 0.0
mLayoutCalledWhileSuppressed = false
mLayoutMode = -1
mLastTouchDownIndex = -1
mHoveredSelf = false
mGroupFlags = 2228307
mPersistentDrawingCache = 2
mSuppressLayout = false
mChildrenCount = 0
mChildCountWithTransientState = 0
mChildAcceptsDrag = false
mUnsetPressedState = null
mAccessibilityDelegate = null
mUnscaledDrawingCache = null
mAnimator = null
mAttachInfo = null
mBackground = {android.graphics.drawable.ColorDrawable@831912688536}
mTransformationInfo = null
mTouchDelegate = null
mTag = null
mSendViewStateChangedAccessibilityEvent = null
mClipBounds = null
mContentDescription = null
mContext = {com.wlodsgn.bunbunup.MenuActivity@831912707472}
mCurrentAnimation = null
mDisplayList = null
mDrawableState = null
mDrawingCache = null
mSendViewScrolledAccessibilityEvent = null
mFloatingTreeObserver = null
mHardwareLayer = null
mScrollCache = {android.view.View$ScrollabilityCache@831912606240}
mResources = {android.content.res.Resources@831912458488}
mInputEventConsistencyVerifier = {android.view.InputEventConsistencyVerifier@831912774440}
mKeyedTags = null
mPerformClick = null
mPendingCheckForTap = null
mLayerPaint = null
mPendingCheckForLongPress = null
mLayoutInsets = null
mLayoutParams = {android.support.v4.widget.DrawerLayout$LayoutParams@831912431416}
mParent = {android.support.v4.widget.DrawerLayout@831912722552}"android.support.v4.widget.DrawerLayout{b1dcc078 VFE..... ......I. 0,0-0,0 #7f090042 app:id/drawer_layout}"
mOverlay = null
mListenerInfo = null
mLocalDirtyRect = null
mMatchIdPredicate = null
mMatchLabelForPredicate = null
mMeasureCache = null
mMeasuredHeight = 0
mMeasuredWidth = 0
mMinHeight = 0
mMinWidth = 0
mNextFocusDownId = -1
mNextFocusForwardId = -1
mNextFocusLeftId = -1
mNextFocusRightId = -1
mNextFocusUpId = -1
mOldHeightMeasureSpec = -2147483648
mOldWidthMeasureSpec = -2147483648
mOverScrollMode = 1
mLeftPaddingDefined = false
mPaddingBottom = 0
mPaddingLeft = 0
mPaddingRight = 0
mPaddingTop = 0
mLeft = 0
mLayerType = 0
mLastIsOpaque = false
mLabelForId = -1
mPrivateFlags = -2121789184
mPrivateFlags2 = 4334600
mPrivateFlags3 = 0
mRecreateDisplayList = false
mID = 2131296324
mRight = 0
mRightPaddingDefined = false
mHasPerformedLongPress = false
mScrollX = 0
mScrollY = 0
mDrawingCacheBackgroundColor = 0
mCachingFailed = false
mSendingHoverAccessibilityEvents = false
mSystemUiVisibility = 0
mBottom = 0
mTop = 0
mBackgroundSizeChanged = true
mTouchSlop = 24
mBackgroundResource = 0
mTransientStateCount = 0
mAccessibilityViewId = -1
mAccessibilityCursorPosition = -1
mUserPaddingBottom = 0
mUserPaddingEnd = -2147483648
mUserPaddingLeft = 0
mUserPaddingLeftInitial = 0
mUserPaddingRight = 0
mUserPaddingRightInitial = 0
mUserPaddingStart = -2147483648
mVerticalScrollFactor = 0.0
mVerticalScrollbarPosition = 0
mViewFlags = 402932225
mWindowAttachCount = 0
adapter = {com.wlodsgn.bunbunup.NavDrawerListAdapter@831912476752}
context = {android.app.Application@831912467056}
navDrawerItems = {java.util.ArrayList@831912670472} size = 2
mDataSetObservable = {android.database.DataSetObservable@831912431560}
mDrawerToggle = null
现在,当我执行跨步操作时,结果如下:
http://imgur.com/eUbJwur,hNwymAF#1
完成注释部分中发布的STEPOVER结果后,请使用变量进行调试,因为它们不允许我添加两个以上的链接。
如果您需要调试中子变量的信息,请告诉我
至于goonerandroid的请求,这是我的styles.xml代码:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
最佳答案
尝试将主题更改为此
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
而不是AppCompat版本。它基本上取决于您要定位的API。如果少于14,则使用
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
然后在您的活动中使用此按钮调用操作栏
getSupportActionBar().setDisplayHomeAsUpEnabled(true);