【android:studio】CardView不能识别!

凉城古梦喵扑街 2017-01-04 07:48:13
eclipse 中无法读取,CardView


studio弄了一个晚上,2个包都打了,
android-support.v7.widget.cardview.jar
android-support-v7-recyclerview.jar

运行时闪退!



...全文
659 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
我解决了! 谢谢大家! http://blog.csdn.net/ssh159/article/details/54287839
  • 打赏
  • 举报
回复
引用 12 楼 ChunDK 的回复:
把你导入的 cardview 去掉 Project structure 里面 加入 MAVEN 的 cardview
你好,你是叫我 将 2个jar包删了,然后在Project structure 加入一些什么吗? 我找不到啊,能不送截图看看?
ChunDK 2017-01-08
  • 打赏
  • 举报
回复
把你导入的 cardview 去掉 Project structure 里面 加入 MAVEN 的 cardview
  • 打赏
  • 举报
回复
引用 9 楼 u013290250 的回复:
[quote=引用 6 楼 ssh159 的回复:] [quote=引用 3 楼 u013290250 的回复:] [quote=引用 2 楼 u013290250 的回复:] 不会吧。需要找到问题所在啊
再build.gradle 添加: compile 'com.android.support:cardview-v7:25.1.0'[/quote] 你好,你说的是这里吗? [/quote] 你放错地方了[/quote] 哪怎样放?
草民一号 2017-01-06
  • 打赏
  • 举报
回复
引用 7 楼 ssh159 的回复:
[quote=引用 5 楼 cat6572325 的回复:] [quote=引用 4 楼 cat6572325 的回复:] 你后面那张图就是运行成功了吗? 错误代码看了没有,什么问题
如果你用的是以前旧版本创建的工程,那么你的style得改[/quote] style?改哪里? 我公布代码: import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.CardView; public class MainActivity extends AppCompatActivity { private CardView cardView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); cardView = (CardView) findViewById(R.id.cardView); cardView.setRadius(8);//设置图片圆角的半径大小 cardView.setCardElevation(8);//设置阴影部分大小 cardView.setContentPadding(5, 5, 5, 5);//设置图片距离阴影大小 } } <android.support.v7.widget.CardView android:id="@+id/cardView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="100dp"> <ImageView android:layout_width="150dp" android:layout_height="match_parent" android:layout_margin="5dp" android:scaleType="centerCrop" android:src="@drawable/sng" /> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp" android:text="动漫之家" android:textSize="18sp" android:textStyle="bold" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp" android:text="极黑的布伦希尔特" /> </LinearLayout> </LinearLayout> </android.support.v7.widget.CardView> [/quote] style文件: <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style>
草民一号 2017-01-05
  • 打赏
  • 举报
回复
引用 4 楼 cat6572325 的回复:
你后面那张图就是运行成功了吗? 错误代码看了没有,什么问题
如果你用的是以前旧版本创建的工程,那么你的style得改
草民一号 2017-01-05
  • 打赏
  • 举报
回复
你后面那张图就是运行成功了吗? 错误代码看了没有,什么问题
怀君 2017-01-05
  • 打赏
  • 举报
回复
引用 2 楼 u013290250 的回复:
不会吧。需要找到问题所在啊
再build.gradle 添加: compile 'com.android.support:cardview-v7:25.1.0'
怀君 2017-01-05
  • 打赏
  • 举报
回复
不会吧。需要找到问题所在啊
怀君 2017-01-05
  • 打赏
  • 举报
回复
引用 6 楼 ssh159 的回复:
[quote=引用 3 楼 u013290250 的回复:] [quote=引用 2 楼 u013290250 的回复:] 不会吧。需要找到问题所在啊
再build.gradle 添加: compile 'com.android.support:cardview-v7:25.1.0'[/quote] 你好,你说的是这里吗? [/quote] 你放错地方了
  • 打赏
  • 举报
回复
报错信息: at com.open_open.android_cardview.MainActivity.onCreate(MainActivity.java:14)  at android.app.Activity.performCreate(Activity.java:6107)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1122)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2463)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2579)  at android.app.ActivityThread.access$800(ActivityThread.java:176)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1452)  at android.os.Handler.dispatchMessage(Handler.java:111)  at android.os.Looper.loop(Looper.java:192)  at android.app.ActivityThread.main(ActivityThread.java:5619)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:976)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)  Suppressed: java.lang.ClassNotFoundException: android.support.v7.cardview.R$styleable at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 27 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
  • 打赏
  • 举报
回复
引用 5 楼 cat6572325 的回复:
[quote=引用 4 楼 cat6572325 的回复:] 你后面那张图就是运行成功了吗? 错误代码看了没有,什么问题
如果你用的是以前旧版本创建的工程,那么你的style得改[/quote] style?改哪里? 我公布代码: import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.CardView; public class MainActivity extends AppCompatActivity { private CardView cardView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); cardView = (CardView) findViewById(R.id.cardView); cardView.setRadius(8);//设置图片圆角的半径大小 cardView.setCardElevation(8);//设置阴影部分大小 cardView.setContentPadding(5, 5, 5, 5);//设置图片距离阴影大小 } } <android.support.v7.widget.CardView android:id="@+id/cardView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="100dp"> <ImageView android:layout_width="150dp" android:layout_height="match_parent" android:layout_margin="5dp" android:scaleType="centerCrop" android:src="@drawable/sng" /> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp" android:text="动漫之家" android:textSize="18sp" android:textStyle="bold" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="5dp" android:text="极黑的布伦希尔特" /> </LinearLayout> </LinearLayout> </android.support.v7.widget.CardView>
  • 打赏
  • 举报
回复
引用 3 楼 u013290250 的回复:
[quote=引用 2 楼 u013290250 的回复:]
不会吧。需要找到问题所在啊

再build.gradle 添加: compile 'com.android.support:cardview-v7:25.1.0'[/quote]

你好,你说的是这里吗?
  • 打赏
  • 举报
回复
求助各位android的dalao!

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧