在棒棒糖前设备中看不到RecyclerView的卡项目详细信息

时间:2015-09-03 07:35:04

标签: android-layout android-5.0-lollipop android-theme android-recyclerview android-viewholder

enter image description here

所以这就是问题,RecyclerView能够在Lollipop设备中显示项目详细信息。但是当我在Lollipop设备中打开时,同样的apk卡片视图中没有显示详细信息..会出现什么问题

RecyclerView(适配器和ViewHolder)

public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.CustomViewHolder> {
private LayoutInflater inflater;
private List<Story> passedData;
public Context context;

public CustomViewHolder onCreateViewHolder(ViewGroup viewGroup, int i)


    inflater = LayoutInflater.from(viewGroup.getContext());
    View v = inflater.inflate(R.layout.item_view, viewGroup, false);

    CustomViewHolder holder = new CustomViewHolder(v);

    return holder;
}

@Override
public void onBindViewHolder(CustomViewHolder holder, int i) {
    Story s = passedData.get(i);
    holder.title.setText(s.title);
    holder.subTitle.setText(s.subTitle);
    holder.thumbNail.setImageResource(s.thumbimageId);

    setAnimation(holder.container, i);


}

@Override
public int getItemCount() {
    return passedData.size();
}

public class CustomViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {

    CardView container;

    TextView title;
    TextView subTitle;
    ImageView thumbNail;
    Typeface tf_regular;

    public CustomViewHolder(View itemView) {
        super(itemView);
        itemView.setOnClickListener(this);
        this.title = (TextView) itemView.findViewById(R.id.storyTitle);
        this.subTitle = (TextView) itemView.findViewById(R.id.storySubTitle);
        this.container = (CardView) itemView.findViewById(R.id.containerView);
        this.thumbNail = (ImageView) itemView.findViewById(R.id.thumbnail);


        tf_regular = Typeface.createFromAsset(context.getAssets(), "fonts/Bertica-Regular.ttf");
        this.title.setTypeface(tf_regular);


    }

styles.xml

<resources>

<!-- Base application theme. -->

<style name="AppTheme" parent="AppTheme.Base">
    <!-- Customize your theme here. -->

</style>

<style name="AppTheme.Base" parent="Theme.AppCompat.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/toolBarBackground</item>

    <item name="colorPrimaryDark">@color/statusBarColor</item>
    <item name="android:windowBackground">@color/gray</item>
    <item name="android:textColorPrimary">@color/textPrimaryColor</item>
    <item name="android:textColorSecondary">@color/textPrimaryColor</item>


</style>

V21 / styles.xml

<?xml version="1.0" encoding="utf-8"?>

<style name="AppTheme" parent="AppTheme.Base">

    <item name="android:colorPrimary">@color/toolBarBackground</item>

    <item name="android:colorPrimaryDark">@color/statusBarColor</item>
    <item name="android:windowBackground">@color/gray</item>
    <item name="android:textColorPrimary">@color/textPrimaryColor</item>
    <item name="android:textColorSecondary">@color/textPrimaryColor</item>

</style>

<style name="customPopUpTheme" parent="ThemeOverlay.AppCompat.Light">

    <item name="android:textColor">@color/toolBarBackground</item>
</style>

的AndroidManifest.xml

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"
    android:name=".MyApplication">

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
      </application>

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

我解决了这个问题。 基本上我的卡片视图有涟漪效果。它不适用于棒棒糖前设备。我删除了我的涟漪效果然后它是一个魅力:)