java - 回收站视图未与 Tablayout 正确对齐
问题描述
我是 android 开发的新手,我应用了带有视图寻呼机的选项卡布局,在片段中我应用了 Recycler 视图但输出 Recyclerview 显示错误,这里我像这样附加了我的 recyclerview 显示
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<android.support.v7.widget.RecyclerView
android:id="@+id/xvehiclelistRV"
android:layout_height="wrap_content"
android:layout_width="match_parent"
/>
我的 Mainactivity.xml
<include
android:id="@+id/custom_actionbar"
layout="@layout/custom_actionbar" />
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/custom_actionbar"
android:background="@color/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#DCEBFF"
app:tabGravity="fill"
app:tabIndicatorColor="@color/colorPrimary"
app:tabIndicatorHeight="2dp"
app:tabSelectedTextColor="#696969"
app:tabTextColor="@color/black"/>
</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.v4.view.ViewPager>
解决方案
这是我的活动设计:-
用我的代码替换 Mainactivity.xml 的代码:-
<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.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/black"
app:tabGravity="fill"
app:tabIndicatorColor="@android:color/white"
app:tabMode="fixed"
app:tabSelectedTextColor="#FFF"
app:tabTextColor="#FFF" />
</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" />
推荐阅读
- c++ - C ++分段错误:11错误,同时编码添加两个数字的链表
- sql - postgreSQL 为不存在的值添加条件
- testing - 对于具有 compileOnly 依赖项的单元测试,我如何避免在运行时重新声明可用性的依赖项?
- spring - 如何在 Spring Boot rest api 的 POST 方法中为现有玩家和游戏在不同时间创建新分数
- sql - SQL 按日期分组,具有多个相同的结果
- vb.net - [VB.NET]Upnp/udp打孔聊天程序tcp/udp sockets
- python - 对部署在 GCP 上的模型进行 API 调用
- javascript - 在空格键上播放的音频点击
- css - 在第一行有行跨度的情况下,在表格的第一行设置 css 样式
- terraform - 通过 REST API 公开 Terraform