我正在尝试添加到页面底部的字幕文本视图中。 添加了它,但是当我这样做时页面无法滚动。我在线性布局中使用此代码。怎么了感谢您的帮助。
这是页面的选取框底部。 https://i.postimg.cc/SQrDzRtq/marque.png
当我更改layout_height时,滚动再次返回,但字幕文本移到页面顶部。
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fbutton="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0691bf"
tools:context=".AnaEkran">
<ScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/arkaplan"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/maç2back"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_marginEnd="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.511"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/maç1back"
fbutton:srcCompat="@color/boxes" />
<View
android:id="@+id/divider8"
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_marginEnd="76dp"
android:background="@android:color/darker_gray"
app:layout_constraintBottom_toBottomOf="@+id/maç3back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/maç3back"
app:layout_constraintVertical_bias="0.431" />
<View
android:id="@+id/divider9"
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_marginEnd="76dp"
android:background="@android:color/darker_gray"
app:layout_constraintBottom_toBottomOf="@+id/maç4back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/maç4back"
app:layout_constraintVertical_bias="0.431" />
<!-- -->
<ImageView
android:id="@+id/maç6back"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_marginEnd="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.511"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/maç5back"
fbutton:srcCompat="@color/boxes" />
.........
</android.support.constraint.ConstraintLayout>
</ScrollView>
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom|center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/scrollingtext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:layout_marginTop="8dp"
android:background="@color/colorPrimary"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textSize="25dp" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
答案 0 :(得分:0)
此代码始终将此TextView保留在页面底部。希望这就是您要寻找的
<?xml version="1.0" encoding="utf-8"?>
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0691bf"
tools:context=".AnaEkran">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:id="@+id/scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/holo_red_dark"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<ImageView
android:id="@+id/maç2back"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_marginEnd="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.511"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/maç1back"
fbutton:srcCompat="@color/boxes" />
<View
android:id="@+id/divider8"
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_marginEnd="76dp"
android:background="@android:color/darker_gray"
app:layout_constraintBottom_toBottomOf="@+id/maç3back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/maç3back"
app:layout_constraintVertical_bias="0.431" />
<View
android:id="@+id/divider9"
android:layout_width="1dp"
android:layout_height="0dp"
android:layout_marginEnd="76dp"
android:background="@android:color/darker_gray"
app:layout_constraintBottom_toBottomOf="@+id/maç4back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/maç4back"
app:layout_constraintVertical_bias="0.431" />
<!-- -->
<ImageView
android:id="@+id/maç6back"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_marginEnd="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.511"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/maç5back"
fbutton:srcCompat="@color/boxes" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/holo_blue_bright"
android:gravity="bottom|center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/scrollingtext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:layout_marginTop="8dp"
android:background="@android:color/white"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textSize="25dp" />
</LinearLayout>
</LinearLayout>