Skip to content

Instantly share code, notes, and snippets.

@crised
Created October 15, 2015 12:36
Show Gist options
  • Save crised/f4e31c3c2477b4ded24c to your computer and use it in GitHub Desktop.
Save crised/f4e31c3c2477b4ded24c to your computer and use it in GitHub Desktop.
//sw600dp/activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context="telematic.cl.popmovies.MainActivity">
<fragment
android:id="@+id/fragment_forecast"
android:name="telematic.cl.popmovies.MoviesFragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
tools:layout="@android:layout/list_content" />
<FrameLayout
android:id="@+id/detail_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
//fragment_main.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="telematic.cl.popmovies.MoviesFragment"
android:layout_width="match_parent"
android:layout_height="match_parent">
<GridView
android:id="@+id/gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="185px"
android:numColumns="@integer/columns"
android:stretchMode="none" />
</FrameLayout>
10-15 09:32:48.332 13391-13391/? E/AndroidRuntime: Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
protected void onCreate(Bundle savedInstanceState
...
setContentView(R.layout.activity_main); //can't inflate!
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment