1
スクロール領域に左の青色のパネルと緑の右のパネルが表示されます。しかし、左のパネルの高さは0です。あなたはそれを修正する方法を知っていますか?ScrollViewでは、RelativeLayoutの子の高さは0です。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFFFF"
android:fadeScrollbars="false"
android:fillViewport="true" >
<RelativeLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFF0000" >
<View
android:id="@+id/right_panel"
android:layout_width="100dp"
android:layout_height="20000dp"
android:layout_alignParentRight="true"
android:background="#FF00FF00" />
<View
android:id="@+id/left_panel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toLeftOf="@id/right_panel"
android:background="#FF0000FF" />
</RelativeLayout>
</ScrollView>
私はスクロールできます。 –
RelativeLayoutをLinearLayout(Horizontal)に変更してください。 – Bhavin
私は、左のパネルの下部と上部を右のパネルに合わせなければならない解決策を見つけました。 <ビュー アンドロイド:ID = "@ + ID/left_panel" アンドロイド:layout_width = "match_parent" アンドロイド:layout_height = "match_parent" アンドロイド:layout_toLeftOf = "@のID/right_panel" アンドロイド:layout_alignTop =」 @ id/right_panel " android:layout_alignBottom =" @ id/right_panel " android:background ="#FF0000FF "/> –