【发布时间】:2018-03-29 11:48:54
【问题描述】:
我有一个想要折叠的视图,所以我将可见性设置为 View.GONE,视图变得不可见,但它仍然占用空间。
我不知道它可能是什么,有人有想法吗?
这是之前的图像(视图 D):
这是(视图 D)之后的图像:
这是布局:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
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"
android:background="@color/mainColor"
android:clipToPadding="false"
android:fillViewport="false"
android:scrollbars="none">
<android.support.constraint.ConstraintLayout
android:id="@+id/options_panel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true">
<!-- other irrelevants views -->
<TextView
android:id="@+id/time_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:fontFamily="sans-serif"
android:text="@string/toolbar_options_title_time"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/option_hexa_sorting" />
<com.development.mekanius.bounce.customElements.HexaRadioGroupView
android:id="@+id/option_hexa_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/time_title" />
<Button
android:id="@+id/option_create_post"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="32dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/option_hexa_time" />
</android.support.constraint.ConstraintLayout>
提前致谢
【问题讨论】:
-
您要隐藏哪个视图? XML 中并不清楚。
-
您查看 GONE 或 INVISIBLE 了吗?
-
对不起。我试图隐藏的视图是 option_hexa_time,我正在使用 View.GONE
-
我已经尝试将视图包装在 LinearLayout 中,但它并没有改变任何东西。
标签: android android-layout android-constraintlayout