gpt4 book ai didi

Android - 微调器 View 超出 ScrollView 尺寸

转载 作者:行者123 更新时间:2023-11-29 23:45:59 25 4
gpt4 key购买 nike

我有一个名为 Measurement 的 DialogActivity。它包含一个框架布局,用于替换“fragment 顶部”或“fragment 底部”。这两个 fragment (顶部/底部)都有一个内部有线性布局的 ScrollView ,并且可以有无限的子 fragment (每行有 2 个微调器和 1 个编辑文本),使用添加按钮添加。

问题是,当添加行时,微调器箭头显示在此 DialogActivity 的 FrameLayout 尺寸之外。 EditText 应该是隐藏的,spinner 的数据也被隐藏但是箭头显示如下图所示:

enter image description here

这里中间的大框表示框架布局区域,微调器不得显示在该区域之外。我也有 。突出显示在框架布局之外的顶部和底部微调器。这是代码:

Activity 测量

<?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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Activities.MeasurementActivity">

<TextView
android:id="@+id/measurement_textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="44dp"
android:text="Measurement"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />


<Button
android:id="@+id/measurement_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="196dp"
android:layout_marginTop="16dp"
android:onClick="top_btn"
android:text="Top"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/measurement_textView16"/>

<Button
android:id="@+id/measurement_bottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="204dp"
android:layout_marginTop="16dp"
android:onClick="btm_btn"
android:text="Bottom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/measurement_textView16"
/>


<FrameLayout
android:id="@+id/measurement_frame"
android:layout_width="559dp"
android:layout_height="476dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="90dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/measurement_textView16">
</FrameLayout>
</android.support.constraint.ConstraintLayout>

fragment 顶部

    <?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
tools:context=".Fragments.topFragment">

<ScrollView
android:layout_width="match_parent"
android:layout_height="300dp">

<LinearLayout
android:id="@+id/fragment_top_ll1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"></LinearLayout>
</ScrollView>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="83dp"
android:layout_gravity="bottom"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="4">

<ImageView
android:id="@+id/fragment_top_imageView4"
android:layout_width="154dp"
android:layout_height="61dp"
android:layout_weight="1"
android:onClick="add"
app:srcCompat="@drawable/ic_add2" />

<ImageView
android:id="@+id/fragment_top_imageView3"
android:layout_width="154dp"
android:layout_height="61dp"
android:layout_weight="1"
android:onClick="remove"
app:srcCompat="@drawable/ic_minus" />
</LinearLayout>

</FrameLayout>

FragmentTopRow

    <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Fragments.topFragment_row">

<!-- TODO: Update blank fragment layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="130dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="7">

<Spinner
android:id="@+id/topFragment_row_sp1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="3"></Spinner>

<Spinner
android:id="@+id/topFragment_row_sp2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="2"></Spinner>

<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:layout_weight="2"
android:inputType="number"
android:textAlignment="center"

/>
</LinearLayout>

最佳答案

我从另一个帖子得到这个解决方案(ScrollView and Spinner)

android:background="#00FFFFFF"

对我有用

关于Android - 微调器 View 超出 ScrollView 尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51400853/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com