2015-01-10 4 views
0

Я не могу получить область просмотра для прокрутки. Я пробовал много вариантов тегов, но безуспешно. Мне нужна светло-желтая (# FFFF99) область, чтобы быть очень большой и чтобы пользователь мог перемещать ее вокруг области просмотра, но кнопки остаются видимыми. Вот мой XML-код.Прокручиваемый XML-вид

<?xml version="1.0" encoding="utf-8"?><!--<?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:orientation="vertical">--> 
<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:background="#FFCCCCCC" 
    android:orientation="vertical" 
    tools:context=".MainActivity"> 

    <LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="50dp" 
    android:layout_gravity="center" 
    android:orientation="horizontal"> 

    <ImageButton 
     android:id="@+id/play_btn" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:contentDescription="@string/dice6" 
     android:src="@drawable/play" /> 

    <ImageButton 
     android:id="@+id/exit_btn" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:contentDescription="@string/exit" 
     android:src="@drawable/exit" /> 
    </LinearLayout> 

    <LinearLayout 

    android:layout_width="wrap_content" 
    android:layout_height="30dp" 
    android:layout_gravity="center" 
    android:orientation="horizontal"> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Commentary" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 
    </LinearLayout> 

    <ScrollView 
    android:id="@+id/scrollView1" 
    adroid:scrollbarAlwaysDrawVerticalTrack="true" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:fillViewport="true"> 

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

     <view 
     android:id="@+id/drawing" 
     class="com.summit.DrawView" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="1.01" 
     android:background="#FFFF99" 
     android:orientation="vertical" /> 

    </LinearLayout> 
    </ScrollView> 
</LinearLayout> 
+0

Можете ли вы определить «без успеха»? например с изображением того, что вы хотите против того, что у вас есть? – ataulm

ответ

0

Его так как внутри вашего прокрутки ширина линейной компоновки является содержимым упаковки. И ширина представлений совпадает с родительским. Эти два противоречат друг другу.

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