我正在设计XML,最初具有与Action ToolBar重叠的协调器布局。我四处阅读,发现添加了app:layout_behavior =“ @ string / appbar_scrolling_view_behavior属性有助于解决此问题。
但是,在我的XML中,协调器布局与“预览”屏幕的底部按钮重叠时仍然存在问题。我知道这些按钮实际上在手机上,但是我仍然困惑为什么布局扩展到这些项目上。看到下面的图像与底部的按钮重叠,我从来不记得在引入协调器布局之前看到过这个图像:
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2.2" />
<LinearLayout
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="0dp"
android:layout_weight="2">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<CheckBox
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.3">
</LinearLayout>
</LinearLayout>
当您添加app:layout_behavior="@string/appbar_scrolling_view_behavior"
其基本功能时,它Toolbar
会将布局设置在下方,并将这两种布局都放入ScrollView之类的东西中。由于Toolbar
在该布局的顶部有一个,因此整个布局(形成的ScrollView)被向下推了高度Toolbar
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句