我想实现一个半透明的状态栏(使我的导航视图是背后的状态栏),但还是喜欢动态地改变我的动作条的颜色.因此,状态栏颜色需要更改为我的操作栏颜色的较暗版本.
如果我将状态栏设置为透明,正如许多来源所示,我的primary_dark颜色用作状态栏的背景.但是,由于我将在运行时更改操作栏颜色,因此primary_dark不一定是我的操作栏的深色.
如果我将状态栏设置为操作栏颜色,则透明度将消失.如果我将状态栏设置为操作栏颜色并添加透明度,状态栏看起来既不错也不正确,我的重叠导航视图仍然不是非常"透明"/"彩色".
Google Inbox有三种不同的颜色:收件箱(蓝色),延后(黄色)和完成(绿色).
我该怎么做才能实现这种行为?
android colors material-design android-design-library navigationview
我的身份验证基于spring-boot-security-example.当我输入无效令牌时,我想抛出401 Unauthorized异常.但是,我总是找不到404资源.我的配置设置了一个异常处理,但它被忽略 - 可能是因为之前添加了我的AuthenticationFilter而请求没有到达我的异常处理程序.
我需要改变什么才能抛出401异常?
我有一个身份验证过滤器:
public class AuthenticationFilter extends GenericFilterBean {
...
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = asHttp(request);
HttpServletResponse httpResponse = asHttp(response);
Optional<String> token = Optional.fromNullable(httpRequest.getHeader("X-Auth-Token"));
try {
if (token.isPresent()) {
logger.debug("Trying to authenticate user by X-Auth-Token method. Token: {}", token);
processTokenAuthentication(token);
addSessionContextToLogging();
}
logger.debug("AuthenticationFilter is passing request down the filter chain");
chain.doFilter(request, response);
} catch (InternalAuthenticationServiceException internalAuthenticationServiceException) {
SecurityContextHolder.clearContext();
logger.error("Internal authentication service exception", internalAuthenticationServiceException);
httpResponse.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); …Run Code Online (Sandbox Code Playgroud) 我有一个BaseTest类,它包含几个测试.每个测试都应该针对我列出的每个配置文件执行.
我想过使用参数化值,例如:
@RunWith(Parameterized.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
// @ActiveProfiles("h2-test") // <-- how to iterate over this?
public abstract class BaseTest {
@Autowired
private TestRepository test;
// to be used with Parameterized/Spring
private TestContextManager testContextManager;
public BaseTest(String profile) {
System.setProperty("spring.profiles.active", profile);
// TODO what now?
}
@Parameterized.Parameters
public static Collection<Object[]> data() {
Collection<Object[]> params = new ArrayList<>();
params.add(new Object[] {"h2-test" });
params.add(new Object[] {"mysql-test" });
return params;
}
@Before
public void setUp() throws Exception {
this.testContextManager = new TestContextManager(getClass());
this.testContextManager.prepareTestInstance(this);
// maybe …Run Code Online (Sandbox Code Playgroud) 这不是一个技术问题,但我现在已多次阅读,1992年从LB Rosenberg开发的虚拟夹具是最早的增强现实应用之一.我想更多地了解这个虚拟装置,但我看不到任何关于这个"应用程序"的信息网站.有人可以向我解释一下,Vitural Fixtures是关于什么的?有没有好的文献资料?我在谷歌找到的唯一的东西是ar的历史摘要 - 没有人解释虚拟装置.
非常感谢
编辑:另外一张关于系统的图片也很有用:)
我正在尝试实现四个自定义形状的按钮,如下图所示:

到目前为止我做了什么:我拍了4张不同的照片 - 每张只有一种颜色可见(见上文).图像的另一部分是透明的.结果是,我有四张相同尺寸的图片.
现在我使用了相对布局,其中我的所有4张图片都被添加到同一位置的图像视图中.由于透明度,我可以看到所需的图片.
对于我的ImageViews,我使用以下内容实现了onTouchListener:
private class ImageOnTouchListener implements View.OnTouchListener {
private int categoryId;
public ImageOnTouchListener(int categoryId) {
this.categoryId = categoryId;
}
@Override
public boolean onTouch(View v, MotionEvent event) {
Bitmap bmp = Bitmap.createBitmap(v.getDrawingCache());
int x = (int) event.getX();
int y = (int) event.getY();
boolean isInsideBitmap = x < bmp.getWidth() && y < bmp.getHeight() && x >= 0 && y >= 0;
boolean isActionUp = event.getAction() == MotionEvent.ACTION_UP;
if (isInsideBitmap) {
int color = bmp.getPixel(x, y);
bmp.recycle();
if (color …Run Code Online (Sandbox Code Playgroud) 我只是想知道当我重新查询我的光标时(例如某些基础数据发生了变化)是否可以为项目的删除/添加设置动画.或者我是否必须手动检查差异并从列表视图中分配/删除它们以获得所需的动画?
我使用了一个不同版本的ListViewAnimations并创建了我自己的游标适配器以供使用.
所以基本上我想知道如何检查光标内部是否存在差异(元素缺失,元素添加)的好方法,这样我就可以设置它们的外观动画.
我正在寻找一种在Android中实现"状态"进度条的流畅方式,如下面三个示例所示.由于我不是重新发明轮子的粉丝,我想问一下我是否有一些我不知道的库.
我查了一下,找不到任何lib,所以我想我需要自己实现它.这样做最简单的解决方案是什么?我应该扩展ProgressBar还是应该从头开始?你有任何我可以建立的建议或教程吗?



我想渲染一个FontAwesome图标作为SVG动态地使用Javascript将其作为图像源提供.我希望我的输出是这样的
PS - 我会自己画圆圈.只需要一种渲染图标的方法.
到目前为止,我尝试过这种方法:
function addSVG() {
var ele = document.getElementById("svg");
var svg = `<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50">
<text x="4" y="15" style="font-family: FontAwesome" fill="red"></text>
</svg>`
var output = 'data:image/svg+xml;base64,' + btoa(svg)
ele.src = output;
}
addSVG()Run Code Online (Sandbox Code Playgroud)
<head>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet">
</head>
<body>
What it should look like:
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20">
<text x="4" y="15" style="font-family: FontAwesome" fill="red"></text>
</svg>
What it looks like:
<img id="svg">
</body>Run Code Online (Sandbox Code Playgroud)
正如您所看到的,没有Javascript(只是在HTML中使用SVG),它可以正常工作.
给定以下布局:
<g>
... // many nodes
<g>
<circle></circle>
<text></text>
</g>
...
</g>
Run Code Online (Sandbox Code Playgroud)
正确的更新模式在d3 v4中会如何?我必须在merge(?)中使用什么作为参数,我必须多久调用一次merge(仅在节点上?节点+圆+文本?)
我在小提琴上创建了一个工作示例:https : //jsfiddle.net/cvvfsg97/6/
码:
function update(items) {
node = nodeLayer.selectAll(".node")
.data(items, function(d) { return d.id; })
node = node.enter() // insert
.append("g")
.attr("class", "node");
node.append("circle") // insert
.attr("r", 2.5)
.attr('class', 'circle')
.merge(nodeLayer.selectAll('.node > circle')) // is this correct?! // merge
.attr('fill', 'red') // just for testing purposes
.exit().remove(); // exit
node.append("text") // insert
.attr("dy", 3)
.text(function(d) { return d.name; })
.merge(nodeLayer.selectAll('.node > text')) // is …Run Code Online (Sandbox Code Playgroud) 我添加了一些MetadataBuilderContributor基于数据库(h2、mysql、oracle)的实现,因为它们的语法略有不同。
截至目前,贡献者的注册通过以下位置的财产进行application.yml:
spring:
jpa:
properties:
hibernate:
metadata_builder_contributor: org.foo.bar.H2Implementation
Run Code Online (Sandbox Code Playgroud)
我知道我可以创建多个配置文件 -h2、-mysql、-oracle 来应用正确的贡献者。但是,我想根据driverClassName设置自动设置这些(如果我能找到匹配项,否则默认为 application.yml)
有没有办法做到这一点而不需要在我的 application.yml 中输入?
android ×4
spring ×3
java ×2
javascript ×2
spring-boot ×2
animation ×1
colors ×1
d3.js ×1
font-awesome ×1
hibernate ×1
history ×1
html ×1
imageview ×1
junit ×1
listview ×1
progress-bar ×1
shape ×1
svg ×1
virtual ×1