安卓工作室 android studio文件和代码模板,以及汉化出错问题

安卓工作室 android studio文件和代码模板,以及汉化出错问题

 

作者:韩梦飞沙

Author:han_meng_fei_sha

 

邮箱:313134555@qq.com

E-mail: 313134555 @qq.com

 

android studio 汉化后,报错。

无法为bundle java util属性资源包找到资源,关键的emmet bem类名称元素分隔符

Can't find resource for bundle java.util.PropertyResourceBundle, key emmet.bem.class.name.element.separator.label

 

捆bundle 

 

某resource不在此文件中,对应的key为 emmet.bem.class.name.element.separator.label

 

BEM的意思就是块(block)、元素(element)、修饰符(modifier)

<form class="search-form">
    <input type="text" class="search-form__username"> <input type="password" class="search-form__password"> <button id="J_Submit" class="search-form__submit--active"></button> <form> 

这里的B,指的是Block,也就是"search-form"
这里的E,指的是Element,也就是跟随在search-form后的"username", "password"和"submit",并且用两个下划线(__)表示承接关系
这里的M,指的是Modifier,也就是submit后面的"active",用两个连接符表示承接关系(--

 

Emmet  是一个网页前端开发工具。

 

Espresso 是个编辑器,Sublime Text 就是个编辑器。

==========详细信息:

Can't find resource for bundle java.util.PropertyResourceBundle, key emmet.bem.class.name.element.separator.label
java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key emmet.bem.class.name.element.separator.label
at java.util.ResourceBundle.getObject(ResourceBundle.java:450)
at java.util.ResourceBundle.getString(ResourceBundle.java:407)
at com.intellij.application.options.emmet.XmlEmmetConfigurable.$$$setupUI$$$(XmlEmmetConfigurable.java)
at com.intellij.application.options.emmet.XmlEmmetConfigurable.<init>(XmlEmmetConfigurable.java:55)
at com.intellij.codeInsight.template.emmet.generators.XmlZenCodingGeneratorImpl.createConfigurable(XmlZenCodingGeneratorImpl.java:155)
at com.intellij.application.options.emmet.EmmetConfigurableProvider.getAvailableConfigurables(EmmetConfigurableProvider.java:41)
at com.intellij.application.options.emmet.EmmetConfigurableProvider.createConfigurable(EmmetConfigurableProvider.java:31)
at com.intellij.openapi.options.ConfigurableEP$ProviderProducer.createElement(ConfigurableEP.java:326)
at com.intellij.openapi.options.ConfigurableEP.createConfigurable(ConfigurableEP.java:273)
at com.intellij.openapi.options.ex.ConfigurableWrapper.createConfigurable(ConfigurableWrapper.java:54)
at com.intellij.openapi.options.ex.ConfigurableWrapper.getConfigurable(ConfigurableWrapper.java:121)
at com.intellij.openapi.options.ex.ConfigurableWrapper.cast(ConfigurableWrapper.java:102)
at com.intellij.openapi.options.ex.ConfigurableWrapper$CompositeWrapper.getConfigurables(ConfigurableWrapper.java:256)
at com.intellij.openapi.options.newEditor.SettingsTreeView$MyNode.buildChildren(SettingsTreeView.java:473)
at com.intellij.ui.treeStructure.CachingSimpleNode.getChildren(CachingSimpleNode.java:36)
at com.intellij.ui.treeStructure.SimpleTreeStructure.getChildElements(SimpleTreeStructure.java:25)
at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.addToCache(FilteringTreeStructure.java:67)
at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.addToCache(FilteringTreeStructure.java:82)
at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.addToCache(FilteringTreeStructure.java:82)
at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.rebuild(FilteringTreeStructure.java:62)
at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.<init>(FilteringTreeStructure.java:54)
at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.<init>(FilteringTreeStructure.java:45)
at com.intellij.ui.treeStructure.filtered.FilteringTreeBuilder.<init>(FilteringTreeBuilder.java:53)
at com.intellij.openapi.options.newEditor.SettingsTreeView$MyBuilder.<init>(SettingsTreeView.java:804)
at com.intellij.openapi.options.newEditor.SettingsTreeView.<init>(SettingsTreeView.java:207)
at com.intellij.openapi.options.newEditor.SettingsEditor.<init>(SettingsEditor.java:149)
at com.intellij.openapi.options.newEditor.SettingsDialog.<init>(SettingsDialog.java:70)
at com.intellij.ide.actions.ShowSettingsUtilImpl.getDialog(ShowSettingsUtilImpl.java:57)
at com.intellij.ide.actions.ShowSettingsUtilImpl.showSettingsDialog(ShowSettingsUtilImpl.java:94)
at com.intellij.ide.actions.ShowSettingsAction.actionPerformed(ShowSettingsAction.java:62)
at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:197)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransactionAndWait(TransactionGuardImpl.java:156)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:211)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$2(ActionMenuItem.java:304)
at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:905)
at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:124)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:284)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:112)
at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
at com.intellij.openapi.application.TransactionGuardImpl.access$300(TransactionGuardImpl.java:40)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:113)
at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:123)
at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:109)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:112)
at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:513)
at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:45)
at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:533)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:795)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:627)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:387)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

=============

 

文件模板 file Templates

检查描述 inspection Descriptions

打算描述 intention Descriptions

后缀模板 postfix Templates

=======

ResourceBundle类是java提供的一个读取properties文件(配置文件)的一种方法。

 

文件中以#开头做为注释,下面是我的数据库连接的配置文件

========

#数据库配置信息
DRIVER=com.mysql.jdbc.Driver
URL=jdbc:mysql: //localhost:3306/test
user=rwuser
password=rwuser
 
#路径配置信息
path=D:\\Java\\jdk1. 6 .0_31\\bin
========
 
下面是我使用ResourceBundle类处理:
========
package  iceinfo.bat.test;
 
import  java.util.ResourceBundle;
 
public  class  TestResourceBundle {
 
     public  static  void  main(String[] args) {
         String fileName= "config" ;
//        config.properties它跟普通java类的命名规则完全一样:   
//        - 文件名和包名是区分大小写   
//        - 扩展名 .properties 省略 
//        - 资源文件必须位于classpath下,如果在某个包下成在定义fileName时要加上包的名称,且包名区分大小写   
//        如果是Web项目,不写包路径可以,此时将资源文件放在WEB-INF\classes\目录下就可以。
         ResourceBundle paramBundle = ResourceBundle.getBundle(fileName);
         System.out.println(paramBundle.getString( "DRIVER" ));
         System.out.println(paramBundle.getString( "URL" ));
         System.out.println(paramBundle.getString( "user" ));
         System.out.println(paramBundle.getString( "PASSWORD" )); //这儿是区分大小写的
         
         System.out.println(paramBundle.getString( "path" ));
     }
}

==========

注:如果fileName的名字中大小写或没有加入properies文件所在的包名那么会报
Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name config1, locale zh_CN
如果在获取properties文件中的key对应的value值时如果没有区分小写会报
Exception in thread "main" java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key PASSWORD
=======
 
emmet.bem.class.name.element.separator.label
 
如何在很多文件中 查找
 

点击组织-文件夹选项

如何搜索文件内容在哪个文件中

 

点到搜索选项卡,选中下面的始终搜索文件名和内容,并点击确定

如何搜索文件内容在哪个文件中

 

如何搜索文件内容在哪个文件中_百度经验

searchableOptions.xml

 然而,这种搜索,对 txt这样的后缀有效。 对其他的 比如.properties 后缀。是无效的。 .properties这种文件里的内容是不会被搜索的。要想搜索,就把后缀改成txt。

 ======

我们发现 汉化的 文件 ActionsBundle.properties 少了很多语句。 所以出现了上面的问题。 对比原来的文件,将必要的语句加上就可以了。

 

 

转载于:https://www.cnblogs.com/yue31313/p/7296921.html

Android Studio中,你可以设置自定义代码模板来加快开发过程。以下是一些常见的 Android Studio 文件代码模板示例: 1. Activity 模板: ```java public class ${NAME} extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.${LAYOUT}); } } ``` 2. Fragment 模板: ```java public class ${NAME} extends Fragment { private ${NAME}ViewModel viewModel; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.${LAYOUT}, container, false); // 初始化视图和逻辑 return rootView; } } ``` 3. RecyclerView Adapter 模板: ```java public class ${NAME}Adapter extends RecyclerView.Adapter<${NAME}Adapter.${ViewHolder}> { private List<${DATA_TYPE}> dataList; public ${NAME}Adapter(List<${DATA_TYPE}> dataList) { this.dataList = dataList; } @NonNull @Override public ${ViewHolder} onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { // 创建 ViewHolder 并返回 } @Override public void onBindViewHolder(@NonNull ${ViewHolder} holder, int position) { // 绑定数据到 ViewHolder 上的视图 } @Override public int getItemCount() { return dataList.size(); } static class ${ViewHolder} extends RecyclerView.ViewHolder { ${ViewHolder}(View itemView) { super(itemView); // 初始化视图 } } } ``` 以上只是一些示例模板,你可以根据自己的需求创建和编辑代码模板。要在Android Studio中设置这些模板,请按照以下步骤操作: 1. 打开 Preferences(或Settings) 对话框。 2. 导航到 Editor > File and Code Templates。 3. 在右侧的面板中,选择对应的文件类型(如Java Class、Java Interface等)。 4. 编辑或添加你的代码模板。 5. 点击“Apply” 或 “OK”保存更改。 希望这些模板对你有帮助!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值