I have two linear layouts and ScrollView in my layout. I add a few views to ScrollView programmatically. All is okay, if views in ScrollView are inside of the screen. But if more views in ScrollView, the first view of scrollview is under layout2 and partly invisible. I tryed relative layout. But the same performance. Of course I'd like to see top element of scrollview without truncating.
My XML is below:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/backNormal"
android:orientation="vertical"
>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:id="@+id/layout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/backNormal"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/imageDriverWaitingBack"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_weight="1"
android:src="@drawable/back"
android:gravity="left"
/>
<TextView
android:id="@+id/textDriverWaitingTitle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Title"
android:gravity="center"
android:textColor="@color/text1"
android:layout_weight="2.13"
/>
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:gravity="right"
android:layout_weight="1"
/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/backDark2"
/>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:id="@+id/layout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/backNormal"
android:orientation="horizontal"
>
<Button
android:id="@+id/dButtonWaitMinus"
android:text='-'
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
style="@style/button_style_normal"
android:layout_weight="1"
/>
<TextView
android:id="@+id/dTextWaitDist"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Distance"
android:gravity="center"
android:textColor="@color/text1"
android:layout_weight="9"
/>
<Button
android:id="@+id/dButtonWaitPlus"
android:text='+'
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1"
style="@style/button_style_normal"
/>
</LinearLayout>
<ScrollView xmlns:android="http://ift.tt/nIICcg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:id="@+id/driverWaitList"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/backNormal"
android:orientation="vertical"
android:layout_gravity="center_horizontal|center_vertical"
>
</LinearLayout>
</ScrollView>
</LinearLayout>
Any ideas please! Thanks!
Aucun commentaire:
Enregistrer un commentaire