Android Studio 中的拖放功能不起作用 [英] Drag/Drop feature in Android studio not working

查看:98
本文介绍了Android Studio 中的拖放功能不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 android 编程的新手 android studio 中的拖放功能不起作用.我无法将任何东西拖到我的手机上.现在我的片段是谷歌地图视图,我想在视图中添加一个搜索栏.它只是不拖.当我尝试在文本中添加它时,它说这里不允许元素项目?

I'm new to android programming The drag/ and drop feature in android studio is not working. I can't drag anything to my phone. Right now my fragment is google map view and i want to add a search bar to the view. It just doesn't drag. When I try to add it in text it says element item not allowed here?

这是我的activity_maps.xml文件

This is my activity_maps.xml file

 <fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:id="@+id/map" tools:context=".MapsActivity"
android:name="com.google.android.gms.maps.SupportMapFragment">
<item android:id="@+id/search"
    android:title="@string/search_title"
    android:icon="@drawable/ic_search"
    android:showAsAction="collapseActionView|ifRoom"
    android:actionViewClass="android.widget.SearchView" />
</fragment>

推荐答案

新版 android studio 为每个布局使用了 2 个 xml 文件.一个(例如 content_main.xml)嵌入到另一个(Activity_main.xml)中.您应该打开 content_*.xml 并在其中进行设计.希望有帮助.

the new version of android studio uses 2 xml files for each layout. One (e.g. content_main.xml) embedded in the other one (Activity_main.xml). you should open the content_*.xml and do the design in it. hope it helps.

这篇关于Android Studio 中的拖放功能不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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