我没有看到gridview android中的项目

时间:2013-12-31 13:42:22

标签: android gridview horizontal-scrolling

我有一个GridView,其中我放了一个水平滚动。当所有垂直滚动都完美地工作时,现在我已经改变了gridview的类型以使其成为水平但你不再看到gridview中的项目。 在xml中:

  <com.jess.ui.TwoWayGridView
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/dashboard_grid_report"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_gravity="center"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:background="#E8E8E8"
            app:gravity="center"
            app:horizontalSpacing="0dp"
            app:scrollDirectionLandscape="horizontal"
            app:scrollDirectionPortrait="horizontal"
            app:stretchMode="none"
            app:verticalSpacing="0dp" />

项目的xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/item_prospect"
     android:layout_width="200dp"
     android:layout_height="200dp"
     android:background="#00BFFF" >

  <TextView
    android:id="@+id/TxtName"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="10dp"
    android:layout_marginTop="10dp"
    android:textColor="@android:color/black" />

 </RelativeLayout>

在文件java中:

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

    View rootView = inflater.inflate(R.layout.fragment_dashboard,
            container, false);


    TwoWayGridView gridViewReport = (TwoWayGridView) rootView.findViewById(R.id.dashboard_grid_report);


    GridClientAdapter customGridClientAdapter = new GridClientAdapter(getActivity().getApplicationContext(), R.layout.item_client, Costant.listReport);        
    gridViewReport.setAdapter(customGridClientAdapter); 

         //......

       return rootView;
}

当它是通常的gridview并且垂直滚动一切正常时,asesso不再有效。谁可以向我解释一下?

1 个答案:

答案 0 :(得分:0)

在xml中删除

 app:stretchMode="none"

它有效