Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. android:layout_width="match_parent"
  3. android:layout_height="match_parent"
  4. android:orientation="vertical">
  5. <RelativeLayout
  6. android:id="@+id/fragment_a"
  7. android:layout_width="match_parent"
  8. android:layout_height="match_parent">
  9. <TextView
  10. android:id="@+id/lv_container"
  11. android:layout_width="match_parent"
  12. android:layout_height="match_parent"
  13. android:gravity="bottom"
  14. android:text="Hello World!"/>
  15. </RelativeLayout>
  16. <!-- this frame is invisible -->
  17. <FrameLayout
  18. android:id="@+id/fragment_b"
  19. android:visibility="invisible"
  20. android:layout_width="fill_parent"
  21. android:layout_height="200dp"
  22. android:background="#FF0000">
  23. <fragment
  24. android:id="@+id/map_v2"
  25. android:layout_width="match_parent"
  26. android:layout_height="match_parent"
  27. class="com.google.android.gms.maps.SupportMapFragment" />
  28. </FrameLayout>
  29. </LinearLayout>
  30.  
  31. @Override
  32. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  33.  
  34. final View rootView = inflater.inflate(R.layout.fragment_favorites, container, false);
  35. final FragmentManager fm = getFragmentManager();
  36. final RelativeLayout fragmentA = (RelativeLayout) rootView.findViewById(R.id.fragment_a);
  37.  
  38. fragmentA.setOnClickListener(new View.OnClickListener() {
  39. @Override
  40. public void onClick(View v) {
  41.  
  42. RelativeLayout fragmentA = (RelativeLayout) getActivity().findViewById(R.id.fragment_a);
  43. FrameLayout fragmentB = (FrameLayout)getActivity().findViewById(R.id.fragment_b);
  44.  
  45. int y = 200;
  46. if (state == true) {
  47. if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
  48. fragmentA.animate().translationY(-y).setDuration(500);
  49. fragmentB.animate().translationY(-y).setDuration(500);
  50. state = false;
  51. }
  52. } else {
  53. if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
  54. fragmentA.animate().translationY(y).setDuration(500);
  55. fragmentB.animate().translationY(y).setDuration(500);
  56. state = true;
  57. }
  58. }
  59. }
  60. });
  61. return rootView;
  62. }
  63.  
  64. 04-19 15:39:43.248 8758-8758/com.mahlzeit E/AndroidRuntime﹕ FATAL EXCEPTION: main
  65. Process: com.mahlzeit, PID: 8758
  66. android.view.InflateException: Binary XML file line #20: Error inflating class fragment
  67. at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
  68. at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
  69. at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
  70. at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
  71. at com.mahlzeit.mahlzeitactivity.FavoritesFragment.onCreateView(FavoritesFragment.java:27)
  72. at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
  73. at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:953)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement