- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
这是我的布局文件。
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ActivityProductList">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@color/primary"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
<ExpandableListView
android:id="@+id/listViewProduct"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="25dip"
android:groupIndicator="@drawable/setting_selector"
android:divider="#FFCC00"
android:dividerHeight="2px"
android:background="@color/windowBackground"
android:layout_below="@+id/toolbar"
android:paddingTop="20dp"
/>
<android.support.design.widget.FloatingActionButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:clickable="true"
android:src="@drawable/cart"
android:layout_margin="16dp"
app:elevation="6dp" />
</android.support.design.widget.CoordinatorLayout>
我想垂直设置所有 3 个元素。但它们在当前布局中重叠。
layout_below 在这里似乎不起作用。
如何解决这个问题?
最佳答案
我已经提到了一个布局 fragment ,我猜这就是你想要的。检查 github
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<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">
<ExpandableListView
android:id="@+id/expandableListView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_menu_edit" />
</android.support.design.widget.CoordinatorLayout>
output
无法帮助您使用 FloatingActionButton
,它应该是 float 的,哈哈 :)
关于android - layout_below 不适用于 CoordinatorLayout android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34798552/
我有一个具有三个 View 的 RelativeLayout。两个 TextViews 都应该在 ImageView 的右边,第二个应该在第一个 TextView 下面。 代码:
我在我的应用程序中广泛使用 RelativeLayouts,并认为我知道如何指定它们,但这让我不知所措。我基本上将 4 个 TextViews 放置在两行中,每行两行,每行包含一个标签和将提供的文本。
我有一个包含两个 TextView 的 RelativeLayout,第二个应该在第一个下面。第一个 TextView 的文本在 onCreate() 中更新,文本包含换行符,这使得它更高,但第二个
我正在尝试在相对布局中制作一个 layout_below cardview,但它不会显示在我的设备中 layout_above 工作的地方。我不知道为什么它不起作用。我认为它应该可以工作,因为它位于
我正在尝试找出一种方法,使布局中的项目与包含的布局中的项目对齐。 这是一个视觉表示: 这是我正在寻找的示例代码(显然不起作用): Main.xml //This would be
我有以下 xml 布局: 目前,它在 Nexus 5X 上可以正确显示所有内容,但在具有不同屏幕尺寸的设备上使用时,布局会变得困惑。为确保不会发生这种情况,我添加了这一行 androi
我有自定义工具栏,我希望我的 ListView 位于 Toolbar 下方。但是 listview 出现在工具栏上,而我的 layout_below 不工作。我知道之前已经问过很多问题。但没有任何效果
我在这里开发了一个应用程序。在这里我希望需要 o/p 如下格式: Artist: artist Duration: duration Title: title. 但是我得到
我有一个自定义 View (MyView),它扩展了 SurfaceView,我在其中覆盖了 onDraw 方法。我使用自定义构造函数动态创建此 View 的实例: MyView myView = n
我有以下 xml 代码。 imagebutton 没有在 textView 下方对齐,边距为 5dp。我想我在理解各种布局参数时犯了一个错误。相对布局是线性布局的 subview ,几乎没有其他 Vi
我想以编程方式做这样的事情- 我尝试这样做: LinearLayout.LayoutParams params = (LinearLayout.LayoutParams)mButton
这是我的布局文件。 我想垂直设置所有 3 个元素。但它们在当前布局中重叠。 layout_below 在这里似乎不起作用。 如何解决这个问题? 最佳答案 我已经提到
是否可以在运行时创建 RelativeLayout 以编程方式设置 android:layout_below 的等效项? 最佳答案 是的: RelativeLayout.LayoutParams pa
android:layout_...可以与ImageView一起使用吗?从图片中您可以看到所有 10 行都在彼此的顶部,这意味着 q2Image 不接受代码 android:layout_below=
我似乎经常制作具有一系列控件的 Android 布局,这些控件旨在一个位于另一个下方。例如 android:layout_below 属性是必需的
我在布置相对布局时遇到问题。这是测试代码 结果是 如果我删除 android:layout_centerInParent="true"一切正常。为什
我正在构建自定义 View 。我能够使用 format="reference" 成功获取资源。但是,我现在想将另一个 View 的 id 作为属性传递,并且我希望遵循与相对布局类似的限制。 这必须是
我有一个 RelativeLayout,它有一个 LinearLayout 作为包含 TextView 的子项。 我想使用 layout_alignRight="@id/userdetail_tv_s
我正在创建包含在 RelativeLayout 中的任意数量的 TextView。如何以编程方式将 TextView 放置在彼此下方或彼此相邻的位置? 我猜我应该使用 layout_toLeftOf
非常新,请原谅误用术语。 我正在学习 Android 开发类(class)来构建一个基本应用程序。我创建了一个 TextView ,然后创建了一个按钮。使用 android:layout_below=
我是一名优秀的程序员,十分优秀!