我試圖爲我的應用程序構建一個gui。它由兩個圖像組成,一個在另一個的上面。底部圖像需要滾動,頂部圖像需要修復。可滾動和不可滾動的圖像
這是考慮到當前的佈局的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:gravity="right"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:orientation="horizontal" >
<Button
android:id="@+id/button_load"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Load" />
<Button
android:id="@+id/button_save"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save" />
</LinearLayout>
<uk.co.test.EditorView
android:id="@+id/EditorView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top" />
<HorizontalScrollView
android:id="@+id/scroll_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom" >
<ImageView
android:id="@+id/image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:src="@drawable/imagemdpi" />
</HorizontalScrollView>
</LinearLayout>
使用這種佈局中,底部圖像不滾動,它被壓縮到屏幕的寬度。如果我刪除了EditorView,它會滾動。我如何根據需要製作gui?
任何幫助感激地收到。謝謝
感謝您的幫助,它現在工作:)。 EditorView包含一個ImageView,我認爲我會嘗試將ImageView放入,並根據您的建議將HorizontalScrollView的layout_width設置爲match_parent,並使用「center」將scaletype放入。 再次感謝。 – JulioM 2013-05-06 22:13:34
@JulioM請接受我的答案,如果它適合你。它有助於我的聲譽,並且如果他們有類似的問題,也可以幫助未來的用戶找到正確的解決方案。 – 2013-05-07 15:33:54
........好的...... – JulioM 2013-05-07 20:39:08