- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个带有 Tabs 的 ViewPager
,里面有一个 Fragment
和 SwipeRefreshLayout
,里面有一个 ListView
,其中包含一些用于测试的元素。
我通常在底部向下滚动列表,我注意到最后一个元素没有正确显示。我搜索了正确的布局,但我仍然遇到同样的问题。
如何修复?
这是我的代码。
ActivityMain
<?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.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>
Fragment Job SwipeRefreshLayout
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/listView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</android.support.v4.widget.SwipeRefreshLayout>
JobListRow
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/job_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="15-1812"
android:textSize="@dimen/text_large"
android:textStyle="bold"/>
<TextView
android:id="@+id/job_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="625 Gallatian/Sunrise"
android:textSize="@dimen/text_medium"
android:layout_below="@+id/job_id"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="@+id/job_brand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sunrise"
android:textSize="@dimen/text_small"
android:layout_below="@+id/job_description"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="@+id/job_status_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Active"
android:textSize="@dimen/text_medium"
android:textColor="@color/primaryText"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true" />
</RelativeLayout>
最佳答案
这是您可以在相对布局中使用 ListView 的示例
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottom"
>
<ListView
android:id="@+id/listView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
<LinearLayout
android:id="@+id/bottom"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
></LinearLayout>
关于android - 为什么我的 SwipeRefreshLayout 中的 ListView 在 Android 上不显示最后一个元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34663756/
我正在尝试 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 之外
我是一名优秀的程序员,十分优秀!