2013-02-16 7 views
0

전체 화면이있어서 바닥에 슬라이딩 서랍을 추가하여 필요한 버튼을 끌어 올리고 싶었습니다. 문제는 화면이 너무 꽉 차 있기 때문에 서랍이 약간 위로 미끄러지는 것뿐입니다. SD가 절반 정도 (내가 오프셋을 사용 하겠지만) 아래에있는 것을 덮어두기를 원합니다. 모든 단서? 여기 Android :: 화면이 가득 차있을 때 슬라이딩 서랍을 열려면 어떻게해야합니까?

내 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> 

가 (충분하지 않은 평판)

+2

전체 앱 디자인에 대한 몇 가지 의견 : 1. 슬라이딩 서랍은 단순히 좋은 UI 패턴이 아니기 때문에 더 이상 사용되지 않습니다 (http://developer.android.com/reference/android). /widget/SlidingDrawer.html). 2. '일부 버튼 끌어 오기'를하려면 ActionBar (http://developer.android.com/guide/topics/ui/actionbar.html)와 메뉴 (http://developer.android.com/guide)를 고려해야합니다. /topics/ui/menus.html). 3. 최근에 많이 사용되는 일반적인 패턴은 슬라이딩 메뉴 (https://github.com/jfeinstein10/SlidingMenu) 일 가능성이 있습니다. – Budius

+0

그래, 고마워, 내가 알았지 만, 지금까지는 좋은 대안을 찾지 못했다. –

답변

2

새로운 루트 GroupView로 RelativeLayout의 추가, 후 모습의 그림을 게시 할 수 없습니다 슬라이딩 서랍을 시작하기 전에 기존의 LinearLayout을 닫습니다. 그런 다음 슬라이드 드로어에 대해 alingparent bottom true를 설정하십시오.

+0

하! 이것은 큰 감사합니다! 그런 다음 drawer 내부의 LinearLayout에'android : background = "# 000000"'을 사용하여 배경이 투명하지 않게했습니다! 완벽하게 작동합니다. –