【发布时间】:2017-10-01 12:22:05
【问题描述】:
如您所见,backButton 位于框架布局的后面。
但我想让这个按钮可以点击,除非它可见。
我使用滚动视图,这意味着我不能将 BackButton 放在上面。 因为当我向上滚动它时它会折叠起来。
这是 XML
<?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"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="230dp"
android:src="@drawable/background"
android:scaleType="centerCrop">
</ImageView>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/backButton"
android:clickable="true"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentTop="true"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:src="@drawable/ic_arrow_back_white"/>
</FrameLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="100dp"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="1">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.74"
android:descendantFocusability="blocksDescendants">
//SOME CONTENT HERE, REMOVED FOR READABILITY
</FrameLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>
简单的问题。怎么样?
【问题讨论】:
-
最简单的方法是将包含您的
Button的FrameLayout放在您的ScrollView之后。 -
框架布局应该包含它拥有的内容!
-
同时发布您的 XML 文件
-
@KulsDroid 如你所说添加了 XML
-
@Xenolion 很抱歉忘了说这是scrollView
标签: android button imagebutton android-framelayout