2013-08-02 3 views
2

Я пытаюсь отобразить большой блок текста с помощью TextView, который не может поместиться на экране. Я попытался окружить это представление с помощью ScrollView и обнаружил, что он используется в изоляции, он работает. Когда я пытаюсь добавить DrawerLayout, действие с возможностью прокрутки больше не работает (но DrawerLayout делает). Я предполагаю, что из-за требования DrawerLayouts использовать FrameLayout. Ниже приведен код xml, который я использую. Большая часть кода следует учебник Google для drawerlayout на http://developer.android.com/training/implementing-navigation/nav-drawer.htmlИспользование макета ящика и просмотр прокрутки в той же деятельности

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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:background="@color/black" 
>  

    <TextView 
    android:id="@+id/city_title" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:textStyle="bold" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:textColor="@color/white" 
    /> 

    <ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:fillViewport="true" 
    android:layout_below="@+id/city_title">  
     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" > 
       <TextView 
        android:id="@+id/city_details" 
        android:layout_width="fill_parent" 
        android:layout_height="0dp" 
        android:layout_weight="1.0" 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:textColor="@color/white"/> 
     </LinearLayout> 
    </ScrollView> 

<android.support.v4.widget.DrawerLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 


    <FrameLayout 
     android:id="@+id/content_frame" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 


    <ListView android:id="@+id/left_drawer" 
     android:layout_width="240dp" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:choiceMode="singleChoice" 
     android:divider="@android:color/transparent" 
     android:dividerHeight="0dp" 
     android:background="#111"/> 

</android.support.v4.widget.DrawerLayout> 

Любые советы или рекомендации будут весьма признателен.

+1

Вы неправильно выбрали ящик. Перечитайте документацию, с которой вы связались, и посмотрите на это после: http://stackoverflow.com/questions/17496007/edittext-inside-of-a-drawerlayout/17496206#answer-17496206 – LuckyMe

+0

Зачем вам DrawerLayout ** внутри ** a RelativeLayout? – Sloy

ответ

0

Я частично решил свою проблему, создав прослушиватель жестов, который будет слушать жесты вниз. Он решает проблему в основном за исключением того, что мне теперь нужно иметь дело с отрывистой прокруткой.

Смежные вопросы