मेरे पास ऐसा ऐप है जो इस तरह से रखा गया है, मुख्य क्रियाशीलता मेज के साथ 2 टैब होस्ट करता है, पहले खंड में एक रीसाइक्लिंग दृश्य होता है जो काम करता है, मैं व्यक्ति स्क्रॉल के रूप में लंबन प्रभाव जोड़ने की कोशिश कर रहा हूं ऊपर या नीचे, मुझे यकीन नहीं था कि मुझे इसे खंड के एक्सएमएल या मुख्य क्रियाशीलता के एक्सएमएल में जोड़ना चाहिए, मैंने इसे मुख्य प्रतिक्रियाशीलता के एक्सएमएल में जोड़ा और मेरे पुनर्नवीनीकरण के रूप में खंड को शामिल किया, यह कहने की जरूरत नहीं है कि लंबन काम नहीं करता है और अब ऐप नहीं खुलता है और मुझे अब NullPointerException मिलता है लेकिन मैंने कोड को स्पर्श नहीं किया। कृपया मुझे सही दिशा में इंगित करें।टूलबार और टुकड़े को संकुचित करना
एक्सएमएल नीचे
frag1.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
MainActivity.xml
<android.support.design.widget.CoordinatorLayout
android:id="@+id/main_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_height="100dp"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
>
<android.support.design.widget.CollapsingToolbarLayout
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<ImageView
android:layout_height="match_parent"
android:layout_width="match_parent"
app:layout_collapseMode="parallax"
/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@color/ColorPrimary"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/toolbar"
android:background="?attr/colorPrimary"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:layout_scrollFlags="enterAlways"
/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_below="@id/tab_layout"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
क्रैश लॉग अंश
07-08 19:43:54.671 2264-2264/com.example.dimple.test E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.dimple.test, PID: 2264
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView$LayoutManager.onMeasure(android.support.v7.widget.RecyclerView$Recycler, android.support.v7.widget.RecyclerView$State, int, int)' on a null object reference
at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:1764)
at android.view.View.measure(View.java:17430)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:727)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:463)
at android.view.View.measure(View.java:17430)
पूर्ण लॉग यहां पाया जा सकता http://pastebin.com/4cPGTx2z
कृपया अपलोड क्रैश लॉग –
@MuthukrishnanSuresh अद्यतन –