我希望ViewGroup中的ImageView,当按下时,绘制波纹,这是有效的!但是当按下ViewGroup时,其中的ImageView应保持透明,否则ImageView背景可见:(实际上,您看到的颜色为alpha-orange,是按下时的纹波).
这仅适用于设备API 21+.设备API <21时,我使用选择器,按下ViewGroup时图像背景保持透明.
layout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_detail_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/margin_left"
android:paddingStart="@dimen/margin_left"
android:paddingTop="@dimen/margin_top_item_field"
android:paddingBottom="@dimen/margin_bottom"
android:baselineAligned="false"
android:background="@drawable/layout"
android:stateListAnimator="@anim/touch_raise"
android:orientation="horizontal">
...
<ImageView
android:id="@+id/item_detail_showfield_icon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/button_mini_oval"
android:stateListAnimator="@anim/touch_raise"
android:clickable="true"
android:contentDescription="@null"
android:scaleType="center"
android:visibility="invisible"
android:src="@drawable/show_button"/>
...
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
绘制/ button_mini_oval.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="oval">
<solid android:color="@color/primary_highlight" />
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="@android:color/transparent" />
</shape>
</item>
</selector>
Run Code Online (Sandbox Code Playgroud)
可绘制-V21/button_mini_oval.xml
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime"
android:color="?android:colorControlHighlight">
<item android:state_pressed="true">
<shape android:shape="oval">
<solid android:color="@android:color/white" />
</shape>
</item>
<item>
<color android:color="@android:color/transparent" />
</item>
</ripple> …
Run Code Online (Sandbox Code Playgroud) 我试图测试一个PhoneJS应用程序,其数据绑定到本地node.js数据服务器(运行在localhost:3000,数据库MongoDB)它在我的浏览器(Chrome)中正常运行:
$.get('http://127.0.0.1:3000/Categories') get correctly the data...
Run Code Online (Sandbox Code Playgroud)
现在尝试模拟移动设备,我通过Ripple模拟器运行它.应用程序在模拟器中正确显示,但在尝试从节点服务器获取数据时失败....
Failed to load resource: the server responded with a status of 500 (Internal Server Error) https://rippleapi.herokuapp.com/xhr_proxy?tinyhippos_apikey=ABC&tinyhippos_rurl=http%3A//127.0.0.1%3A3000/Categories
Run Code Online (Sandbox Code Playgroud)
回国
{
"code": "ECONNREFUSED",
"errno": "ECONNREFUSED",
"syscall": "connect"
}
Run Code Online (Sandbox Code Playgroud)
AM我错过了一些重要的参数?
这是我的server.js:
var express = require('express'),
categories = require('./routes/category'),
products = require('./routes/product');
var app = express();
cors = require('./cors');
app.use(cors);
// categories
app.get('/categories/:id', categories.findById);
app.get('/categories', categories.findAll);
// products
app.get('/categories/:id/products', products.findByCategory);
app.get('/products/:id', products.findById);
app.get('/products', products.findAll);
app.listen(3000);
console.log('Listening on port 3000...');
Run Code Online (Sandbox Code Playgroud) 我有一个奇怪的错误,我试图使用纹波仿真器.我创建了一个项目:phonegap create asdf我进入项目:cd asdf我编译到android:phonegap构建android之后我想使用ripple amulator:ripple模拟Chorme打开,我从默认项目中看到消息"device is ready"几秒钟后它给了我这个错误:"看起来我们这里有一个失败...模仿你看到这个窗口,因为它看起来像僵尸启示录已经开始.出于某种奇怪的原因,它看起来像我们无法加载.这可能是你的应用程序的问题,我们或你可能需要更多的时间来完成加载.点击"等待"给你的应用程序更多的时间.点击"FIRE !!"拿起霰弹枪和吹走所有Ripple的设置,试图清除不好的东西."| 我使用最新的phonegap 3.3 ant最新的波纹0.9.20并且我安装了node.js并且我有.cordova文件夹.
这是控制台:
Console was cleared ripple.js:37
Ripple :: Environment Warming Up (Tea. Earl Gray. Hot.) ripple.js:37
cordova :: Initialization Finished (Make it so.) ripple.js:37
The key "target-densitydpi" is not supported. localhost/:25
Received Event: deviceready index.js:47
cordova :: fired deviceready event! ripple.js:37
Run Code Online (Sandbox Code Playgroud)
谢谢!
我设法构建了Ripple Emulator开源软件(https://github.com/apache/incubator-ripple).
我根据说明(Jake构建)构建了它,它创建了Chrome扩展目标,允许我通过我内置的chrome扩展测试我的网络应用程序,按照https://github.com/apache/incubator-ripple/blob /master/doc/chrome_extension.md.
我成功地将解压缩的扩展加载到chrome上,但是当我启用它时没有任何反应,虽然页面重新加载扩展不起作用,而是我得到2个错误:
未捕获的ReferenceError:未定义webkitNotifications
webkitNotifications.createHTMLNotification('/views/update.html').show();
Run Code Online (Sandbox Code Playgroud)运行tabs.executeScript时未经检查的runtime.lastError:无法访问chrome:// URL
chrome.tabs.executeScript(tabId, {
Run Code Online (Sandbox Code Playgroud)我该如何解决这个问题?
完整的background.js:
if (!window.tinyHippos) {
window.tinyHippos = {};
}
tinyHippos.Background = (function () {
var _wasJustInstalled = false,
_self;
function isLocalRequest(uri) {
return !!uri.match(/^https?:\/\/(127\.0\.0\.1|localhost)|^file:\/\//);
}
function initialize() {
// check version info for showing welcome/update views
var version = window.localStorage["ripple-version"],
xhr = new window.XMLHttpRequest(),
userAgent,
requestUri = chrome.extension.getURL("manifest.json");
_self.bindContextMenu();
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
var manifest = JSON.parse(xhr.responseText),
currentVersion = …
Run Code Online (Sandbox Code Playgroud) 我试图在Visual Studio 2015中使用Ripple来调试我的应用程序.我想查看本地存储,但是当我打开开发人员工具时,Chrome关闭,Javascript控制台显示以下错误:
文件'mdha:http://code.ionicframework.com/1.0.0-rc.5/js/ionic.bundle.min.js'的源地图'angular-sanitize.min.js.map' 不可能是由于错误'异常类型'引发了TypeScriptSourceMapReader.SourceMapReadFailedException'而从指定位置读取.源代码地图使用不受支持的格式源地图使用不受支持的格式源地图使用不受支持的格式
我该如何摆脱错误?
编辑
我使用File-> New Project-> Javascript-> Apache Cordova Apps-> Ionic Tabs App创建了一个新项目.我看到了一个对话框:
您的项目使用的TypeScript版本早于Visual Studio当前安装的版本.如果您尝试构建项目,可能会出错.您是否希望我们在项目文件中升级TypeScriptToolsVersion,以便您再次看不到此警告?
回答"否"以及我遇到的问题.回答"是"并且它没有.....所以我想我需要弄清楚如何让Visual Studio再次给我对话,或者弄清楚如何手动更改它....
编辑2 我试过这个:
<TypeScriptToolsVersion>1.4</TypeScriptToolsVersion>
1.6还没有运气......
编辑3 我刚刚意识到,当我关闭浏览器窗口时,总是会显示关于源图"angular-sanitize.min.js.map"未被读取的消息,而不仅仅是当它崩溃时.所以这个消息可能对这个特定问题没什么帮助.
编辑4 我将我的应用程序复制到使用Ionic Tabs App创建的新工作项目中,我仍然遇到问题.可能是两个不同的根本原因.
google-chrome-devtools ripple cordova visual-studio-2015 ionic
我有下面的 XML,并试图在单击时创建连锁反应。ListView 中每个项目的背景都是黑色,因此理想情况下,波纹效果会生成某种灰色:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/white" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@color/black"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView1"
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/placeholder" />
<TextView
android:id="@+id/latest_item_question"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/white" />
Run Code Online (Sandbox Code Playgroud)
该代码创建以下内容。请注意,我想介绍棒棒糖之前和之后:
我正在尝试为自定义按钮添加涟漪效果.但我发现的唯一解决方案是添加一个背景,我已经为实现该按钮的圆角而做了.现在我想添加涟漪效果.这是我的按钮标签到目前为止的样子:
<Button
android:text="PLAY"
android:id="@+id/button"
android:textSize="20dp"
android:layout_width="75dp"
android:layout_height="75dp"
android:background="@drawable/roundedbutton"
android:onClick="gotomainpage"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="200dp" />
Run Code Online (Sandbox Code Playgroud) 我在回收视图中有一个列表项,我想在整个元素上获得涟漪效果 - 目前我的 GIF 与涟漪重叠。我不知道如何解决这个问题,经过研究已经尝试了很多方法,但没有任何效果。
这是我构建每个列表项所基于的特定 XML 文件。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/selector"
android:clickable="false">
<pl.droidsonroids.gif.GifTextView
android:layout_width="84dp"
android:layout_height="84dp"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:paddingRight="1dp"
android:paddingLeft="1dp"
android:background="@drawable/a_present_for_you"
/>
<TextView
android:id="@+id/textView"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="@color/black"
android:textSize="16sp"
android:gravity="center_vertical"
android:drawableRight="@drawable/ic_lock_open_blue_24dp"
android:drawablePadding="16dp">
</TextView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我创建了一个按钮,我想为该按钮添加涟漪效果和渐变!
这是我的按钮代码:
<Button
android:id="@+id/percentageButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/gradient"
android:gravity="center"
android:text="%"
android:textColor="@android:color/white"
android:textSize="30dp">
</Button>
Run Code Online (Sandbox Code Playgroud)
这是我的gradient.xml文件代码
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners
android:radius="0dp"/>
<gradient
android:gradientRadius="100"
android:centerX="49%"
android:centerY="50%"
android:centerColor="#434343"
android:startColor="#0F0F0F"
android:endColor="#141414"
android:type="radial"/>
</shape>
Run Code Online (Sandbox Code Playgroud)
我已经尝试了所有的可能性,但没有得到如何实现这一点。
我正在开发一个具有minSdkVersion = 16的应用程序,我需要在Lollipop及以上版本中使用涟漪效果,并在较低版本上使用其他一些效果.
有没有办法用XML做到这一点?