Domanda

I've got a full screen so I wanted to add a sliding drawer at the bottom to be able to pull up some buttons that I will need. Problem is the drawer will only slide up a little because the screen is so full. I want the SD to open up about half way (I'll use an offset) but covering what ever is beneath. Any clues?

Here is my XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#00000000"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/txtRecipeViewRecipeName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="#FF005555"
        android:text="@string/recipeName"
        android:textAppearance="?android:attr/textAppearanceLarge" />

            <ScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="124dp"
        android:background="#FF005500" >

    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageView
            android:id="@+id/recipeViewImage"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="fill"
            android:layout_weight="10"
            android:contentDescription="@string/banner_alt"
            android:scaleType="centerCrop"
            android:src="@drawable/ic_launcher" />

        <TableLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0" >

            <RatingBar
                android:id="@+id/recipeViewRatingBar"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fitsSystemWindows="false"
                android:maxHeight="10dp"
                android:maxWidth="10dp"
                android:numStars="4" />

            <TableRow
                android:layout_width="fill_parent"
                android:layout_height="33dp"
                android:layout_weight="1" >

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:text="@string/recipePostedBy" />

                <TextView
                    android:id="@+id/txtRecipeViewAuthor"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_marginLeft="10dp"
                    android:text="@string/recipeAuthor"
                    android:textStyle="bold" />
            </TableRow>

                            <TableRow
                                android:layout_width="match_parent"
                                android:layout_height="20dp"
                                android:layout_weight="1" >

                             <TextView
                                 android:id="@+id/txtRecipeViewNumReviews"
                                 android:layout_width="fill_parent"
                                 android:layout_height="fill_parent"
                                 android:layout_gravity="right|center_vertical"
                                 android:layout_weight="0"
                                 android:paddingTop="12dp"
                                 android:text="@string/recipeReviewCount"
                                 android:textStyle="bold" />

                              <Button
                                  android:id="@+id/btnRecipeViewReviews"
                                  android:layout_width="wrap_content"
                                  android:layout_height="match_parent"
                                  android:layout_marginLeft="10dp"
                                  android:layout_weight="0"
                                  android:text="@string/recipeReviews" />

                            </TableRow>



        </TableLayout>


    </TableRow>

</TableLayout>

<TableLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

            <TableRow
                android:layout_width="wrap_content"
                android:layout_height="match_parent" >

        <TextView
            android:id="@+id/txtRecipeViewPreptime"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:paddingBottom="15dp"
            android:paddingLeft="15dp"
            android:paddingRight="15dp"
            android:paddingTop="15dp"
            android:text="Prep time: "
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <TextView
            android:id="@+id/txtRecipeViewCooktime"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:paddingBottom="15dp"
            android:paddingLeft="15dp"
            android:paddingTop="15dp"
            android:text="Cook time: "
            android:textAppearance="?android:attr/textAppearanceMedium" />

            </TableRow>

</TableLayout>



            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/ingredientList"
                android:textAppearance="?android:attr/textAppearanceMedium" />

        <TextView
            android:id="@+id/txtRecipeViewIngredientList"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_weight="1"
            android:background="#07000000"
            android:ems="10"
            android:padding="20dp"
            android:textColor="#EEEEEEAA" />


        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/cookingDirections"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <TextView
            android:id="@+id/txtRecipeViewDirections"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_weight="1"
            android:background="#07000000"
            android:ems="10"
            android:padding="20dp"
            android:textColor="#EEEEEEAA" />

    </LinearLayout>
    </ScrollView>

<SlidingDrawer
    android:id="@+id/recipeViewSlidingDrawer"
    android:layout_width="wrap_content"
    android:layout_height="26dp"
    android:layout_gravity="bottom"
    android:minHeight="50dp"
    android:content="@+id/content"
    android:handle="@+id/handle" >

    <Button
        android:id="@+id/handle"
        android:layout_width="304dp"
        android:layout_height="22dp"
        android:text="@string/recipeHandle" />

    <LinearLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <Button
        android:layout_width="304dp"
        android:layout_height="35dp"
        android:text="@string/recipeHandle" />

        <Button
        android:layout_width="304dp"
        android:layout_height="35dp"
        android:text="@string/recipeHandle" />

        <Button
        android:layout_width="304dp"
        android:layout_height="35dp"
        android:text="@string/recipeHandle" />

    </LinearLayout>
</SlidingDrawer>

Couldn't post a pic of what it looks like (not enough repute)

È stato utile?

Soluzione

add a RelativeLayout as a new Root GroupView, after that close the existant main LinearLayout before starting the sliding drawer. After that, set alingparent bottom true for sliding drawer.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top