- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 SwipeRefreshLayout,其中包含用于聊天 Activity 的 RecyclerView。我将其底部限制在屏幕底部线性布局的顶部:
<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="fill_parent"
android:layout_height="fill_parent"
android:background="@color/colorPrimaryDark"
android:paddingLeft="0dp"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="0dp"
android:paddingBottom="0dp"
tools:context="org.andrewedgar.theo.ChatRoomActivity">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swiperefresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/listFooter"
app:layout_constraintBottom_toTopOf="@+id/listFooter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/chatRecyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
app:layout_constraintBottom_toTopOf="@+id/listFooter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
</android.support.v4.widget.SwipeRefreshLayout>
<LinearLayout
android:id="@+id/listFooter"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="@drawable/custom_border"
android:gravity="bottom"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<EditText
android:id="@+id/messageInput"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:ellipsize="start"
android:gravity="center"
android:hint="@string/prompt_msg"
android:imeActionLabel="@string/action_send"
android:imeOptions="actionUnspecified"
android:inputType="textCapSentences|textAutoCorrect"
android:maxLines="2"
android:textColor="@color/white"
android:textColorHint="@color/hintColor"
android:importantForAutofill="no" tools:targetApi="o"/>
<ImageButton
android:id="@+id/sendButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:contentDescription="@string/action_send"
android:padding="10dp"
android:src="@android:drawable/ic_menu_send" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
..但是 SwipeRefreshLayout 仍然占据了整个屏幕并且消息出现在消息输入后面:
是否需要特殊类型的约束才能起作用?
最佳答案
将 SwipeRefreshLayout
的高度更改为 0dp
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swiperefresh"
android:layout_width="match_parent"
android:layout_height="0dp"
为什么?
根据 documentation :
You can set the view size to a ratio such as 16:9 if at least one of the view dimensions is set to "match constraints" (0dp).
还有
Note: You cannot use
match_parent
for any view in aConstraintLayout
. Instead use "match constraints
" (0dp).
关于java - SwipeRefreshLayout 不遵守约束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52909400/
我正在尝试 react-native run-android 有这个问题吗?? Could not resolve all files for configuration ':react-native
关于我的环境的信息 Mac OS 大苏尔:11.4 VS for Mac:8.10.6(内部版本 10) Xamarin.Android:11.3.0.4 SDK 工具版本:26.1.1 SDK平台工
我正在开发一个 Android 应用程序。我将 listview 与 SwipefreshLayout 一起使用。但是当我使用 SwipefreshLayout 刷新 ListView 时,加载圈永远
我的应用程序包含一个 SwipeRefreshLayout ,其中包含一个 listView 。该列表从服务器接收数据。因此,当获取数据并且正确填充列表时,滑动刷新可以工作,但是当数据未传递到列表并且
我在使用 SwipeRefreshLayout 时遇到了内存泄漏问题,想知道是否有任何方法可以通过解决方法来解决此问题? 在一个空项目中,以滑动布局作为主要 Activity 的根,如果你向下滑动,并
我尝试为现有的 ListView 实现 SwipeRefreshLayout,但每当我运行该程序时,即使我通过拉动刷新它,它也只显示一项。但是,刷新动画有效。相关代码如下: items = (
这个问题在这里已经有了答案: When I am scrolling up SwipeRefreshLayout refreshing my app (4 个答案) 关闭 3 年前。 我有一个带有
我正在我的应用程序中实现 SwipeRefreshLayout。我已成功实现 OnRefreshListener,并且能够正确刷新 ListView 项目。 我的问题是,如果我向下滑动,当 Swipe
fragment 的onCreateView方法内部: swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefresh
我有以下问题:我有很长的 ListView,但是当我向上滚动时会触发 onRefresh,而不是先滚动回顶部。我该如何解决这个问题? 我将以下 fragment 插入到 FrameLay
我有一个 SwipeRefreshLayout,其中包含用于聊天 Activity 的 RecyclerView。我将其底部限制在屏幕底部线性布局的顶部:
我在我的布局中使用了 SwipeRefreshLayout,我需要显示一个动画来调整已被下拉的距离。 到目前为止,我还没有找到任何方法来检测已拉动的实际距离。 SwipeRefreshListener
我喜欢新的 SwipeRefreshLayout!它看起来很棒,而且非常容易使用。但我想在两个方向上使用它。我有一个消息屏幕,我想通过从上到下滑动来加载旧消息,我想通过从下到上滑动来加载新消息。 这个
我正在使用支持库中的 SwipeRefreshListener。我正在从 AsyncTask 的 onPreExecute 和 onPostExecute 调用 setRefresh。然而,什么都没有
是否可以在不显示进度微调器的情况下执行 SwipeRefreshLayout 功能。现在,它的默认拉动刷新行为完美无缺地显示了 Progress 微调器和 onRefresh() 我隐藏了它。但我想将
我正在为 Google 支持库的 SwipeRefreshLayout 中的文档而苦苦挣扎。 当我使用 setOnRefreshListener 设置的回调接收到刷新调用时,我执行了我的操作,之后我发
有没有办法使用主题修改 SwipeRefreshLayout 中箭头的颜色? 我知道您可以通过编程方式使用此代码 public void setColorSchemeResources (int...
我已经实现了一个将 SwipeRefreshLayout 作为内容 View 的 fragment 。刷新动画在 onRefresh 时触发,但即使在从服务器检索数据后将 setRefreshing
我有一个向用户显示项目列表的 Activity ,它使用了分页库。我的问题是当用户向下滑动屏幕时我无法重新加载列表,以便它再次从服务器获取数据。 这是我的数据源工厂: public class Cou
我在我的 listView 中添加了一个“拉动刷新”,我还想在列表为空时添加一个空 View - 现在我收到了这个错误。我怎样才能使这项工作?如果我将 View 定位在 swipeRefresh 之外
我是一名优秀的程序员,十分优秀!