我想使用已与新的Android L移动开发者预览版支持库介绍(如提到的新CardView小部件在这里),这似乎是V7支持库的一个新版本的一部分.
我现在更新了我的SDK版本,下载了最新的Support Library软件包,但我仍然找不到新的CardView小部件.
我已经搜索了网络和官方文档,但无法获得有关我可以获得新支持库的任何提示.
任何帮助都非常感谢!
编辑:我正在使用ADT/Eclipse
我不知道为什么我的卡在API 21和19仿真器上显示为灰色。我以前用CardViews构建过RecyclerViews,它们是白色的。我不会在任何地方更改背景颜色。在我的API 26仿真器上看起来正常。
这是我的卡片布局:
<android.support.v7.widget.CardView 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="wrap_content"
android:layout_margin="8dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/text_view_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:text="Name"
android:textColor="@android:color/black"
android:textSize="20sp" />
<ImageView
android:id="@+id/image_view_upload"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_below="@+id/text_view_name" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的适配器类:
public class ImageAdapter extends RecyclerView.Adapter<ImageAdapter.ImageViewHolder> {
private Context mContext;
private List<Upload> mUploads;
public ImageAdapter(Context context, List<Upload> uploads) {
mContext = context;
mUploads = uploads;
}
@Override
public ImageViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(mContext).inflate(R.layout.image_item, parent, false);
return new ImageViewHolder(v);
}
@Override
public …
Run Code Online (Sandbox Code Playgroud) 我已经成功地使用CardView实现了RecyclerView.但现在我也想从API 14获得支持.目前看起来我们需要API 17来支持recyclerview.
任何人都知道可以在4.0操作系统或任何其他解决方案中使用RecyclerView吗?