【问题标题】:I do not see the items in the gridview android我没有看到gridview android中的项目
【发布时间】:2014-01-18 10:42:43
【问题描述】:

我有一个 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 并且垂直滚动一切正常时,assesso 不再工作。谁能给我解释一下?

【问题讨论】:

    标签: android gridview horizontal-scrolling


    【解决方案1】:

    在 xml 中删除

     app:stretchMode="none"
    

    有效

    【讨论】:

      猜你喜欢
      • 2015-10-09
      • 1970-01-01
      • 2019-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多