dieses Layout mit dem Namen Songlist meiner XML ist:BottomSheetBehavior ist kein Kind von CoordinatorLayout
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/viewA"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.6"
android:background="@android:color/holo_purple"
android:orientation="horizontal"/>
<android.support.v4.widget.NestedScrollView
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/holo_blue_bright"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="308dp"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:clickable="true"
android:src="@drawable/personlog"
app:layout_anchor="@id/viewA"
app:layout_anchorGravity="bottom|center"/>
</android.support.design.widget.CoordinatorLayout>
und das ist mein Fragment, das dieses Layout enthält:
public class SongList extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.songlist,container,false);
textView=(TextView)view.findViewById(R.id.txt);
View bottomSheet = view.findViewById(R.id.bottom_sheet);
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
bottomSheetBehavior.setPeekHeight(200);
return view;}
}
aber wenn Mittagessen die App geben Sie mir diesen Fehler:
java.lang.IllegalArgumentException: The view is not a child of CoordinatorLayout
aus dieser Zeile:
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
, wie dieses Problem beheben? scheint alles gut funktionieren, aber diesen Fehler geben ... wenn jemand bitte
also wie kann dieses Layout mit echter Weise gemacht werden? Wenn Sie eine Lösung haben, antworten Sie bitte – Erf
Ich füge NestedScrollView in CoordinatorLayout aber immer noch das gleiche Problem – Erf
kann Ihren Punkt verstehen. Wenn Sie mir helfen wollen, bitte beantworten Sie meine Frage nicht kommentieren dann sagen Sie mir, wo Code geändert werden muss, was oder etwas so. Tnx – Erf