StevenRudenko / ActionsContentView

ActionsContentView is an standalone library implements actions/content swiping view (AKA Side Navigation UI Pattern, AKA Facebook side menu). The library doesn't use any specific code introduced in new Android SDK versions. This allows develop an application with an action/content swiping view for every version of Android from 2.2 and up.
https://play.google.com/store/apps/details?id=sample.actionscontentview
441 stars 179 forks source link

Set content to custom layout instead of fragment #6

Closed egfconnor closed 11 years ago

egfconnor commented 11 years ago

I would like to set a linear layout with a few views and then put a fragment at the bottom of the layout, how would I do this using your library? I'm confused mostly due to not knowing how the fragment transaction knows that R.id.content is only the content part of the ActionsContentView.

StevenRudenko commented 11 years ago

Hello,

R.id.content is used to add fragments to FrameLayout dynamically so it does mean nothing for ActionsContentView library. It doesn't use any hardcoded ids to work with.

Here is layout you can use as content.xml layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:id="@+id/views_bar"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:orientation="horizontal" >

        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#ff33b5e5"
            android:padding="4dp"
            android:text="Hello, I am first view"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="#ffffff" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#ff0099cc"
            android:padding="4dp"
            android:text="Hello, I am second view"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="#ffffff" />
    </LinearLayout>

    <FrameLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_alignParentBottom="true"
        android:layout_below="@id/views_bar" />

</RelativeLayout>

two_views_on_top_of_fragment

I suggest you read android developers articles about work with fragments. Here is link for one of them http://developer.android.com/guide/components/fragments.html