将Horizo ntalGridView设置为不垂直滚动

问题描述 投票:1回答:1

我正在使用HorizontalGridView创建产品幻灯片,但我只需要幻灯片水平滚动即可。我尝试setVerticalScrollBarEnable(false),但不起作用。

我认为问题不在于Scroll,因为是像在所有方向上移动所有horizo​​ntalgridview的运动。

我的代码的一部分:

public class ListProductsFragment extends android.support.v4.app.Fragment {

private HorizontalGridView gridView;
private OffersAdapter offersAdapter;
private ArrayList<Offer> offers;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    offersKey = getArguments().getStringArrayList(Constants.EXTRA_OFFERS_KEYS);

    View view = inflater.inflate(R.layout.list_products_fragment,null);

    gridView = (HorizontalGridView) view.findViewById(R.id.product_gridview);
    gridView.setNumRows(2);
    gridView.setRowHeight(225);

    return view;

}}

我的布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" android:layout_width="match_parent"
    android:background="@android:color/transparent"
    android:layout_height="500dp">

    <android.support.v17.leanback.widget.HorizontalGridView
        android:id="@+id/product_gridview"
        android:layout_width="match_parent"
        android:layout_height="500dp"
        />

</LinearLayout>
android scroll android-gridview
1个回答
0
投票

您是否找到了解决方法?

© www.soinside.com 2019 - 2024. All rights reserved.