ore*_*ion 9 android android-recyclerview
我有一个recylcler视图,但似乎没有实现setGravity方法.
我的列表是水平对齐的,但我需要它居中.我怎么做?
fragment_my_zone_item_controlled.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dark_grey">
<FrameLayout
android:id="@+id/fragment_my_zone_item_controlled_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/fragment_my_zone_item_controlled_tabs"
android:layout_marginBottom="12dp"
android:layout_marginTop="12dp" />
<android.support.v7.widget.RecyclerView
android:id="@+id/fragment_my_zone_item_controlled_tabs"
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="@color/action_bar_color"
android:scrollbars="none" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

这就是它的外观,我需要它的中心
感谢你们
我知道这是非常晚的答案,可能是其中一些人得到了这方面的帮助所以请尝试添加这样的
<android.support.v7.widget.RecyclerView
android:id="@+id/fragment_my_zone_item_controlled_tabs"
android:layout_width="wrap_content"
android:layout_height="44dp"
android:layout_centerHorizontal="true"
android:background="#dddddd"
android:scrollbars="none" />
Run Code Online (Sandbox Code Playgroud)
添加 android:layout_centerHorizontal="true"方法
| 归档时间: |
|
| 查看次数: |
7176 次 |
| 最近记录: |