dspec
=====
A simple way to define and render UI specs on top of your Android UI.
![](images/sample.png)
Usage
-----
Enclose the target UI with a `DesignSpecFrameLayout`, usually the root of your view hierarchy.
Get the associated `DesignSpec` instance with `getDesignSpec` and then you can:
* Toggle baseline grid visibility with `setBaselineGridVisible(boolean)`.
* Change baseline grid cell width with `setBaselineGridCellSize(int)`.
* Change baseline grid color with `setBaselineGridColor(int)`.
* Toggle keylines visibility with `setKeylinesVisible(boolean)`.
* Change keylines color with `setKeylinesColor(int)`.
* Add keylines with `addKeyline(int, From)`.
* Toggle spacing markers visibility with `setSpacingsVisible(boolean)`.
* Change spacing markers color with `setSpacingsColor(int)`.
* Add spacing marker with `addSpacing(int, int, From)`.
You can also specify the design spec in a raw JSON resource like:
```json
{
"baselineGridVisible": true,
"baselineGridCellSize": 8,
"keylines": [
{ "offset": 16,
"from": "LEFT" },
{ "offset": 72,
"from": "LEFT" },
{ "offset": 16,
"from": "RIGHT" }
],
"spacings": [
{ "offset": 0,
"size": 16,
"from": "LEFT" },
{ "offset": 56,
"size": 16,
"from": "LEFT" },
{ "offset": 0,
"size": 16,
"from": "RIGHT" }
]
}
```
Because `DesignSpec` is a `Drawable`, you can simply add it to a
`ViewOverlay` if you're running your app on API level >= 18:
```java
DesignSpec designSpec = DesignSpec.fromResource(someView, R.raw.some_spec);
someView.getOverlay().add(designSpec);
```
Download
--------
Download [the latest JAR][1] or grab via Gradle:
```groovy
compile 'org.lucasr.dspec:dspec:0.1.1'
```
or Maven:
```xml
<dependency>
<groupId>org.lucasr.dspec</groupId>
<artifactId>dspec</artifactId>
<version>0.1.1</version>
</dependency>
```
License
--------
Copyright 2014 Lucas Rocha
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
[1]: https://oss.sonatype.org/service/local/artifact/maven/redirect?r=releases&g=org.lucasr.dspec&a=dspec&e=aar&v=LATEST
没有合适的资源?快使用搜索试试~ 我知道了~
已取消-定义和提交-UI-specs-on-top-of-dspec-[DEPRECATED]-Define-and
共33个文件
xml:8个
java:5个
png:5个
需积分: 5 0 下载量 25 浏览量
2024-08-26
13:45:49
上传
评论
收藏 282KB ZIP 举报
温馨提示
[已取消]_定义和提交_UI_specs_on_top_of__dspec_[DEPRECATED]_Define_and_render_UI_specs_on_top_of__dspec.zip
资源推荐
资源详情
资源评论
收起资源包目录
[已取消]_定义和提交_UI_specs_on_top_of__dspec_[DEPRECATED]_Define_and_render_UI_specs_on_top_of__dspec.zip (33个子文件)
dspec-master
gradle.properties 522B
gradle
wrapper
gradle-wrapper.jar 49KB
gradle-wrapper.properties 232B
LICENSE.txt 11KB
library
gradle.properties 55B
src
main
java
org
lucasr
dspec
DesignSpec.java 20KB
RawResource.java 2KB
DesignSpecFrameLayout.java 2KB
res
values
attrs.xml 793B
AndroidManifest.xml 209B
build.gradle 237B
sample
src
main
java
org
lucasr
dspec
sample
SimpleAdapter.java 6KB
MainActivity.java 3KB
res
drawable-mdpi
app_icon.png 5KB
drawable-xhdpi
app_icon.png 14KB
drawable-xxhdpi
app_icon.png 19KB
values
dimens.xml 703B
strings.xml 883B
styles.xml 742B
layout
item.xml 2KB
main_activity.xml 1KB
raw
main_activity_spec.json 543B
drawable-hdpi
app_icon.png 9KB
AndroidManifest.xml 918B
build.gradle 345B
gradlew.bat 2KB
CHANGELOG.md 131B
build.gradle 148B
settings.gradle 37B
gradlew 5KB
.gitignore 193B
images
sample.png 160KB
README.md 3KB
共 33 条
- 1
资源评论
好家伙VCC
- 粉丝: 2073
- 资源: 9145
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功