Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
- <RelativeLayout
- android:id="@+id/fragment_a"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <TextView
- android:id="@+id/lv_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="bottom"
- android:text="Hello World!"/>
- </RelativeLayout>
- <!-- this frame is invisible -->
- <FrameLayout
- android:id="@+id/fragment_b"
- android:visibility="invisible"
- android:layout_width="fill_parent"
- android:layout_height="200dp"
- android:background="#FF0000">
- <fragment
- android:id="@+id/map_v2"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- class="com.google.android.gms.maps.SupportMapFragment" />
- </FrameLayout>
- </LinearLayout>
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- final View rootView = inflater.inflate(R.layout.fragment_favorites, container, false);
- final FragmentManager fm = getFragmentManager();
- final RelativeLayout fragmentA = (RelativeLayout) rootView.findViewById(R.id.fragment_a);
- fragmentA.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- RelativeLayout fragmentA = (RelativeLayout) getActivity().findViewById(R.id.fragment_a);
- FrameLayout fragmentB = (FrameLayout)getActivity().findViewById(R.id.fragment_b);
- int y = 200;
- if (state == true) {
- if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
- fragmentA.animate().translationY(-y).setDuration(500);
- fragmentB.animate().translationY(-y).setDuration(500);
- state = false;
- }
- } else {
- if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
- fragmentA.animate().translationY(y).setDuration(500);
- fragmentB.animate().translationY(y).setDuration(500);
- state = true;
- }
- }
- }
- });
- return rootView;
- }
- 04-19 15:39:43.248 8758-8758/com.mahlzeit E/AndroidRuntime﹕ FATAL EXCEPTION: main
- Process: com.mahlzeit, PID: 8758
- android.view.InflateException: Binary XML file line #20: Error inflating class fragment
- at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
- at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
- at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
- at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
- at com.mahlzeit.mahlzeitactivity.FavoritesFragment.onCreateView(FavoritesFragment.java:27)
- at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
- at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:953)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement