Chcę wyśrodkować mój LinearLayout w ScrollView. Kiedy wysokość LinearLayout jest mała, jest wyśrodkowana w porządku (patrz obrazek # 1), ale kiedy wysokość LinearLayout jest większa niż wysokość ekranu, zachowuje się dziwnie. Nie widzę góry LinearLayout (patrz obrazek # 2), a na dole ScrollView jest olbrzymi padding. Nie wiem, co się tutaj dzieje. Kiedy w LinearLayout jest dużo treści, cały ekran powinien wyglądać jak na obrazku nr 3.Wyśrodkuj zawartość w widoku przewijania
Oto mój plik układ:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cccfff" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="28dp"
android:background="#ffffff"
android:orientation="vertical"
android:paddingBottom="40dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="40dp" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/tip_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:text="Title"
android:textColor="@color/orange_text"
android:textSize="@dimen/font_size_medium" />
<TextView
android:id="@+id/tip_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Description description..."
android:textSize="@dimen/font_size_small" />
</LinearLayout>
</ScrollView>
zestaw 'layout_gravity = center' za poglądy zostać skoncentrowane * * –
Ty, Panie, zasługują na upvote dla "Push tempo, tempo naciskać, naciskać tempo wcisnąć tempo" –