膨胀类android.support.v7.app.MediaRouteButton时出错 [英] Error inflating class android.support.v7.app.MediaRouteButton

查看:70
本文介绍了膨胀类android.support.v7.app.MediaRouteButton时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了android-support-v7-appcompat,android-support-v7-mediarouter库项目来构建路径。

I've added the android-support-v7-appcompat,android-support-v7-mediarouter library project to build path.

以下是我的主要活动,导入按钮没有错误,但是在执行应用程序时,会发生膨胀MediaRouteButton的错误。
非常感谢您的任何建议!

following are my main activity and no errors for import the button, but when execute the app, error inflating MediaRouteButton happens. Thanks a lot for any advice!

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
> 
<android.support.v7.app.MediaRouteButton
            android:id="@+id/castbutton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="2"
            >
</android.support.v7.app.MediaRouteButton>'

...

public class MainActivity extends android.support.v4.app.FragmentActivity 
        implements OnClickListener {
private android.support.v7.app.MediaRouteButton castbutton;


推荐答案

首先,您应该替换此

<android.support.v7.app.`MediaRouteButton`
        android:id="@+id/castbutton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        >
</android.support.v7.app.MediaRouteButton>

<android.support.v7.app.MediaRouteButton
        android:id="@+id/castbutton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        >
</android.support.v7.app.MediaRouteButton>

更新:您必须 appcompat引用首先。要将appcompat库添加到您的库中,请执行以下操作右键单击项目转到属性-> android ---> ib标签添加appcompat项目。

Update: You must appcompat referecning first. To add appcompat library into your Follow the steps Right Click Project--> go to properties--> android ---> ib tab to add the appcompat project.

这篇关于膨胀类android.support.v7.app.MediaRouteButton时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆