在本文中,我们将带你了解在IntellijIDEA/AndroidStudio中使用合并根标签预览布局在这篇文章中,我们将为您详细介绍在IntellijIDEA/AndroidStudio中使用合并根
在本文中,我们将带你了解在 Intellij IDEA/Android Studio 中使用合并根标签预览布局在这篇文章中,我们将为您详细介绍在 Intellij IDEA/Android Studio 中使用合并根标签预览布局的方方面面,并解答androidstudio合并代码常见的疑惑,同时我们还将给您一些技巧,以帮助您实现更有效的android studio & intellj idea禁用文件拖动和代码拖动、Android Studio 4.0.1和IntelliJ 2020.2 IDE之间的Gradle兼容性、android studio 无法在可视化页面预览布局文件、Android Studio/IntelliJ IDEA 翻译插件,可中英互译。。
本文目录一览:- 在 Intellij IDEA/Android Studio 中使用合并根标签预览布局(androidstudio合并代码)
- android studio & intellj idea禁用文件拖动和代码拖动
- Android Studio 4.0.1和IntelliJ 2020.2 IDE之间的Gradle兼容性
- android studio 无法在可视化页面预览布局文件
- Android Studio/IntelliJ IDEA 翻译插件,可中英互译。
在 Intellij IDEA/Android Studio 中使用合并根标签预览布局(androidstudio合并代码)
假设我们正在开发基于 LinearLayout 的复合组件。所以,我们创建这样的类:
public class SomeView extends LinearLayout { public SomeView(Context context, AttributeSet attrs) { super(context, attrs); setOrientation(LinearLayout.VERTICAL); View.inflate(context, R.layout.somelayout, this); }}
如果我们将LinearLayout
用作 的根somelayout.xml
,我们将有额外的视图级别,所以我们使用合并标签:
<?xml version="1.0" encoding="utf-8"?><merge xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Some text" android:textSize="20sp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Some other text"/></merge>
但在 IDE 合并的 Preview 选项卡中,始终充当 FrameLayout,我们会看到类似的内容:
(就是Android Studio,Intellij IDEA也一样,关于Eclipse我不知道)
预览大大加快了布局的开发速度,即使对于某些布局也失去了如此大的帮助,这很可悲。可能有一种方法可以指定,预览应该如何解释merge
特定布局中的标签?
答案1
小编典典有一个新的 parentTag 工具属性(在 Android Studio 2.2
中添加),您可以使用它来指定合并标签的布局类型,这将使布局在布局编辑器预览中正确呈现。
所以使用你的例子:
<merge 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" tools:parentTag="LinearLayout" tools:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Some text" android:textSize="20sp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Some other text"/></merge>
注意 :必须同时指定 和 才能使布局在编辑器中正确显示android:layout_width
。android:layout_height
android studio & intellj idea禁用文件拖动和代码拖动
android studio 和 intellj idea操作通用的(本就是一个ide)...
关闭左侧文件列表拖动
关闭代码拖动
Android Studio 4.0.1和IntelliJ 2020.2 IDE之间的Gradle兼容性
不。 问题出在IntelliJ平台的其他版本中。 Android Studio和IntelliJ Idea是分开开发的,因为它是不同公司的不同产品。 Google在Android Studio中采用了IntelliJ平台-因此我们可以将其视为被黑的IDEA。 因此,通常存在向后兼容性-这意味着我可以在较旧的项目中使用IntelliJ IDEA的新版本打开,反之亦然。 因此,如果查看AS 4.0发行说明,我们可以提到它基于IntelliJ IDEA 2019.3.3(https://developer.android.com/studio/releases#4.0-idea-2019-3-3)。但是,您尝试打开较新版本的IntelliJ Platform(2020.2)的项目。因此失败了,因为您尝试通过旧的IDEA(2019.3.3)打开较新的项目版本(2020.2) 但是您可以毫无问题地使用IDEA 2020.2打开AS 4.0项目-它只会将较旧的项目布局转换为新的项目。
android studio 无法在可视化页面预览布局文件
Rendering Problems
the following classes could not be found:
android.support.v7.internal.widget.ActionBarOverlayLayout (Fix Build Path, Edit XML, Create Class)
Tip: Try to build the project
解决办法:
把style文件中theme改一下
在Theme.AppCompat.Light.DarkActionBar前面加上Base. 如下
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
当然,开发完APP也是需要进行全方位的检测:www.ineice.com
Android Studio/IntelliJ IDEA 翻译插件,可中英互译。
英文不好,所以用有道API写了一个IntelliJ IDEA/Android Studio 翻译插件:
下载与使用:https://github.com/YiiGuxing/TranslationPlugin
项目地址:https://github.com/YiiGuxing/TranslationPlugin
今天关于在 Intellij IDEA/Android Studio 中使用合并根标签预览布局和androidstudio合并代码的讲解已经结束,谢谢您的阅读,如果想了解更多关于android studio & intellj idea禁用文件拖动和代码拖动、Android Studio 4.0.1和IntelliJ 2020.2 IDE之间的Gradle兼容性、android studio 无法在可视化页面预览布局文件、Android Studio/IntelliJ IDEA 翻译插件,可中英互译。的相关知识,请在本站搜索。
本文标签: