context

App内切换语言

非 Y 不嫁゛ 提交于 2020-02-15 22:23:06
转载请注明出处 http://www.cnblogs.com/cnwutianhao/p/6746981.html 前几天客户提需求,对App增加一个功能,这个功能目前市面上已经很常见,那就是应用内切换语言。啥意思,就是 英、中、法、德、日。。。语言随意切换。 (本案例采用Data-Bingding模式,麻麻再也不用担心我findViewBy不到Id了哈哈,开个玩笑) 先上示例图: 代码实现: 布局文件(Data-Binding模式),很简单就是两行文字 <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android"> <RelativeLayout xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.tnnowu.android.switchlanguage.MainActivity"> <TextView android:id="@+id/titleTextView" android:layout_width=

springMVC版本和jdk版本不匹配造成的问题

…衆ロ難τιáo~ 提交于 2020-02-15 20:33:40
一个简单的例子项目,使用springMVC的版本是3.2,jdk的版本是1.7,使用的是注解的处理器适配器和处理器映射器。spring的xml配置文件中单独配置每个handler,可以正常的使用,如果使用context:component-scan(组件扫描)的方式自动注册handler,在浏览器中输入访问url的时候,服务器报一下错误。 经过搜索查看是因为jdk的版本过高导致的,因此升级springMVC到4.2版本,可以正常使用。 java.lang.IllegalArgumentException at org.springframework.asm.ClassReader.(Unknown Source) at org.springframework.asm.ClassReader.(Unknown Source) at org.springframework.asm.ClassReader.(Unknown Source) at org.springframework.core.type.classreading.SimpleMetadataReader.(SimpleMetadataReader.java:53) at org.springframework.core.type.classreading.SimpleMetadataReaderFactory

打造自己的图表控件5

有些话、适合烂在心里 提交于 2020-02-15 14:15:24
上一次加入了鼠标拖拽功能,这回加入我来加入一个区域框,并且框内数据的阴影,效果如下 具体实现思路就是,可以响应鼠标事件来移动和调整大小,并且获取覆盖的数据,画出阴影. 响应鼠标事件可以改造上次写的鼠标移动的功能 区域框的设计为2部分,一部分是上下的区域,用来移动整个区域框,一部分为左右的线,用来改变区域框的大小. 鼠标在这两个部分上点击时才会捕获鼠标事件. 具体实现如下 class VerticalRangeNavigation extends MouseNavigation { constructor() { super() this.start = [] this.draging = false this.screen = [] this.range = [] this._area = { "topBar":"topBar", "bottomBar":"bottomBar", "left":"left", "right":"right", "none":"none" } this.barSize = 20 this.hitTarget = this._area.none this.color = "#FF00FF" } setRange(from, to){ this.range = [from , to] } hit(mouseEventArgs) { if (this

Android 自定义通用Dialog

夙愿已清 提交于 2020-02-15 08:07:04
public MyDialog(Context context, int width, int height, View layout) { super(context, R.style.DialogTheme); setContentView(layout); Window window = getWindow(); WindowManager.LayoutParams params = window.getAttributes(); params.width = width; params.height = height; params.gravity = Gravity.CENTER; //显示的位置 window.setAttributes(params); } 使用: int width = getResources().getDisplayMetrics().widthPixels;//获取popwindow展示的宽 int height = getResources().getDisplayMetrics().heightPixels;//获取popwindow展示的高 MyDialog mMyDialog = new MyDialog(this, width * 3 / 4 , height * 3 / 5, view, R.style.DialogTheme);

AndroidStudio学习笔记(GreenDao)

試著忘記壹切 提交于 2020-02-15 06:00:14
Android开发中,一说到数据库,刚开始接触的肯定是 LitePal LitePal用起来确实很方便,但这次我们要学习的是 GreenDao GreenDao的优点网上一查就知道,学习GreenDao最直观的区别就是新建DaoManager和DaoUtil的工具类,增删改查操作实现比较直观 添加依赖 在 build.gradle (整个项目)中 buildscript { repositories { jcenter ( ) mavenCentral ( ) // add repository } dependencies { classpath 'com.android.tools.build:gradle:3.1.1' classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2' // add plugin } } 在 build.gradle (app)中 apply plugin : 'com.android.application' apply plugin : 'org.greenrobot.greendao' // apply plugin dependencies { implementation 'org.greenrobot:greendao:3.2.2' // add library } 创建model类

30Springd的包扫描——<context:component-scan base-package=” ”/>

自古美人都是妖i 提交于 2020-02-14 05:46:33
在context中配置 如:在base-package 指明一个包: <context:component-scan base-package="cn.edu.dao"/> 表明cn.gacl.java包及其子包中,如果某个类的头上带有特定的注解 @Component,@Repository,@Service,@Controller,就会将这个对象作为Bean注册进 spring 容器。 在<context:component-scan base-package=” ”/>中 指定多个包: <context:component-scan base-package="cn.edu.dao.impl ,cn.edu.service.impl ,cn.edu.action"/> 多个包 逗号隔开。 来源: https://www.cnblogs.com/shenxiaoquan/p/5956942.html

<context:annotation-config> 和 <context:component-scan>的区别

半世苍凉 提交于 2020-02-14 04:37:28
转自: GOOD spring <context:annotation-config> 跟 <context:component-scan>诠释及区别 <context:annotation-config> 是用于激活那些已经在spring容器里注册过的bean(无论是通过xml的方式还是通过package sanning的方式)上面的注解,是一个注解处理工具, 也就是只管注入,不管注册bean 。 <context:component-scan> 除了具有 <context:annotation-config>的功能之外, <context:component-scan> 还可以在指定的package下扫描以及注册javabean , 也就是既管注入,又管注册bean 。 下面我们通过例子来详细查看他们的区别, 有三个class A,B,C,并且B,C的对象被注入到A中. package com.xxx; public class B { public B() { System.out.println("creating bean B: " + this); } } package com.xxx; public class C { public C() { System.out.println("creating bean C: " + this); } } package

spring <context:annotation-config> 跟 <context:component-scan>诠释及区别

元气小坏坏 提交于 2020-02-14 04:32:51
<context:annotation-config> 和 <context:component-scan>的区别 Difference between <context:annotation-config> vs <context:component-scan> <context:annotation-config> 是用于激活那些已经在spring容器里注册过的bean(无论是通过xml的方式还是通过package sanning的方式)上面的注解。 <context:component-scan>除了具有<context:annotation-config>的功能之外,<context:component-scan>还可以在指定的package下扫描以及注册javabean 。 下面我们通过例子来详细查看他们的区别, 有三个class A,B,C,并且B,C的对象被注入到A中. [java] view plaincopy在CODE上查看代码片派生到我的代码片 01.package com.xxx; 02.public class B { 03. public B() { 04. System.out.println("creating bean B: " + this); 05. } 06.} 07. 08.package com.xxx; 09.public class C

Spring.xml中配置注解context:annotation-config和context:component-scan简述

99封情书 提交于 2020-02-14 04:31:18
XML中context:annotation-config和context:component-scan简述 <context:annotation-config/>                            中文意思: <上下文:注解——配置/> <context:component-scan base-package=" 扫描路劲" annotation-config=true/>   中文意思: <上下文:部件——扫描 基础——包=“扫描路径” 注解——配置=true/>(annotation-config=true是默认的配置可省略不写) 1. <context:annotation-config/>  <context:annotation-config/>配置的 作用:是向Spring容器注册一次注入 四个BeanPostProcessor AutowiredAnnotationBeanPostProcessor CommonAnnotationBeanPostProcessor PersistenceAnnotationBeanPostProcessor RequiredAnnotationBeanPostProcessor AutowiredAnnotationBeanPostProcessor旧版注入方式<bean class=" org

IntellliJ IDEA+maven+spring+springMVC+tomcat搭建本地开发环境(一)

我们两清 提交于 2020-02-14 00:34:14
1.新建maven项目,选择如下选项,然后进入下一步 2.输入项目相应的信息,进入下一步 3.配置maven环境,其中有个下载依赖包失败的问题,下篇将提到解决 4.点击finish,等待maven下载相应的jar包,创建src/main/webapp/WEB-INF/web.xml,src/main/java,src/main/resources,项目结构如下: 5.引入java web项目相关到spring和springmvc的jar依赖,pom文件中添加如下: 1 <dependency> 2 <groupId>org.springframework</groupId> 3 <artifactId>spring-core</artifactId> 4 <version>${spring.version}</version> 5 </dependency> 6 <dependency> 7 <groupId>org.springframework</groupId> 8 <artifactId>spring-context</artifactId> 9 <version>${spring.version}</version> 10 </dependency> 11 <dependency> 12 <groupId>org.springframework</groupId> 13