Ich möchte ein TextView am unteren Rand meiner ScrollView hinzufügen, in dem ich die Versionsnummer eingeben kann. Wenn ein Benutzer den Bildschirm zum ersten Mal betritt, sieht er die Versionsnummer nicht. Nachdem sie nach unten geblättert haben, können sie die Versionsnummer unten auf dem Bildschirm sehen. Ich habe alle möglichen Wege ausprobiert, funktioniert nicht. Das Layout ist schön verschachtelt.Wie setze ich eine TextView am Ende meiner ScrollView?
This is the screenshot of the layout implementing the code below
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/linearLayoutThatDoesNotScroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_splash"
android:clickable="true"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/cnt_full">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="false"
android:layout_centerVertical="true"
android:layout_gravity="center">
<com.onkore.app.view.FontTextView
android:id="@+id/profile_num_trophies_won"
style="@style/Theme.App.Text.Headline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginTop="@dimen/cnt_half"
android:drawablePadding="@dimen/cnt_tiny"
android:drawableStart="@drawable/icon_trophy"
android:fontFamily="thick"
android:gravity="center_vertical"
android:text="99"
android:textColor="@color/color_text_primary_inverse"
android:textSize="32sp" />
<com.onkore.app.view.FontTextView
style="@style/Theme.App.Text.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/profile_num_trophies_won"
android:text="@string/profile_trophies"
android:textColor="@color/color_text_primary_inverse" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/profile_user_pic"
android:layout_width="@dimen/profile_image_size"
android:layout_height="@dimen/profile_image_size"
android:layout_centerInParent="true"
android:layout_centerVertical="false"
android:src="@drawable/icon_profile_default"
app:riv_oval="true" />
<com.mikhaellopez.circularprogressbar.CircularProgressBar
android:id="@+id/profile_progress_bar"
android:layout_width="@dimen/profile_progress_bar_size"
android:layout_height="@dimen/profile_progress_bar_size"
android:layout_centerHorizontal="false"
android:layout_centerInParent="true"
android:layout_centerVertical="false"
app:cpb_background_progressbar_color="@color/color_base"
app:cpb_background_progressbar_width="@dimen/elev_06"
app:cpb_progress="25"
app:cpb_progressbar_color="@color/color_progress"
app:cpb_progressbar_width="@dimen/cnt_tiny" />
<com.onkore.app.view.FontTextView
android:id="@+id/profile_level"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/profile_progress_bar"
android:layout_centerHorizontal="true"
android:layout_centerInParent="false"
android:layout_marginTop="@dimen/cnt_dbl"
android:textColor="@color/color_text_primary_inverse"
android:textSize="@dimen/text_size"
tools:text="Level 99" />
</RelativeLayout>
<com.onkore.app.view.FontTextView
android:id="@+id/profile_okoins"
style="@style/Theme.App.Coins.Balance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
tools:text="999k" />
</RelativeLayout>
<com.onkore.app.view.FontTextView
style="@style/Theme.App.Tile.Text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/cnt_full"
android:layout_marginStart="@dimen/cnt_full"
android:layout_marginTop="@dimen/cnt_full"
android:background="@drawable/bg_card_empty"
android:gravity="center"
android:paddingBottom="@dimen/cnt_dbl"
android:paddingTop="@dimen/cnt_part"
android:text="Tap to Personalize"
android:textAllCaps="true"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_primary_translucent"
android:visibility="gone">
<com.onkore.app.view.FontTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Friends" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
>
<TextView
android:id="@+id/versionName"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/cardview_dark_background"
android:gravity="center_vertical|center_horizontal|center"
android:text="HAHA"
android:textColor="@color/cardview_light_background"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Haben Sie versucht, das übergeordnete LinearLayout der Textansicht auszurichten. android: layout_alignParentBottom = "true" Oder verschieben Sie es zu einem relativen Layout und damit: Layout_below –