XML导致膨胀异常

问题描述 投票:-1回答:1

我有此错误:

Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class fragment ERROR ANDROID STUDIO

我的布局部分:

<fragment
    android:id="@id/imageView"
    class="com.example.probaharta.Main"
    android:layout_width="match_parent"
    android:layout_height="448dp"
    android:visibility="@string/google_maps_key"
    tools:layout="@layout/activity_main"
    tools:src="@layout/activity_main" />

</LinearLayout>

我的方法:

protected void onCreate (Bundle savedInstanceState){
   super.onCreate(savedInstanceState);

   setContentView(R.layout.activity_main);

   findViewById(android.R.id.content).setKeepScreenOn(true);
    imageview = findViewById(R.id.imageView);


    downloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
    locationManager = IALocationManager.create(this);

    Utils.shareTraceId(findViewById(R.id.imageView), Main.this, locationManager);
android fragment
1个回答
0
投票

android:visibility =“ @ string / google_maps_key”听起来不正确。该值应该为“ gone”,“ visible”或“ invisible”。.并且Google Maps key绝对是一个字符串,其中不包含提到的可能的属性。

复制/粘贴错误?

© www.soinside.com 2019 - 2024. All rights reserved.