当前位置: 编程技术>移动开发
本页文章导读:
▪分享十个来自知名设计社区drippple.com的免费纹理设计 分享10个来自知名设计社区drippple.com的免费纹理设计
日期:2012-6-5 来源:GBin1.com
如果你是一个UI或者图形设计师的话,一定听说过drippple.com,这是一个超棒的设计师社区,很多知名的设计.........
▪ jQuery的适用特性扩展类库:jQuery++ jQuery的实用特性扩展类库:jQuery++
日期:2012-6-7 来源:GBin1.com
jQuery是一个伟大的javascript框架类库,现在越来越多的应用到了web和网站开发中。无论你做任何种的web开发,你都或多或少的
.........
▪ 自定义ViewGroup兑现自动换行的布局 自定义ViewGroup实现自动换行的布局
viewgroup简单说就是可以装view的view.今天遇到一个问题,就是需要一个可以自动根据一行中view的宽度自动换行的布局,网上找了下,没有相关的例子.........
[1]分享十个来自知名设计社区drippple.com的免费纹理设计
来源: 互联网 发布时间: 2014-02-18
分享10个来自知名设计社区drippple.com的免费纹理设计
日期:2012-6-5 来源:GBin1.com
如果你是一个UI或者图形设计师的话,一定听说过drippple.com,这是一个超棒的设计师社区,很多知名的设计公司和设计师都在这里发布和分享自己的作品。如果你在寻找设计灵感,drippple肯定是你的一个不错的创意来源。
今天我们这里收集了10个超棒的Photoshop纹理设计,希望大家能够在自己的设计作品中使用到,谢谢!
Speckle Brushes made of Cocoa8 Eight Free Fabric User Interface Textures
Subtle Brush Set 3
7 Minimal Textures
Watercolour Textures Pack
.....
.....
来源:分享10个来自知名设计社区drippple.com的免费纹理设计
[2] jQuery的适用特性扩展类库:jQuery++
来源: 互联网 发布时间: 2014-02-18
jQuery的实用特性扩展类库:jQuery++
日期:2012-6-7 来源:GBin1.com
jQuery是一个伟大的javascript框架类库,现在越来越多的应用到了web和网站开发中。无论你做任何种的web开发,你都或多或少的 接触过这个超棒的类库。虽然这个类库非常不错,但是它并不能帮助我们处理所有的相关操作和特性。很多的时候我们需要使用到那些被jQuery忽略的特性。
今天我们介绍一个超棒的DOM辅助/事件类库: jQuery++ ,它是一个DOM辅助方法和事件处理类库,用来帮助我们处理jQuery忽略的一些特性。注意这不是一个jQuery UI类库,只是一些底层处理的的DOM工具。你可以使用它们来更加方便的进行DOM处理。
注意这不是一个jQuery UI类库,不能够帮助你生成特定的界面样式,如果你需要处理页面UI,请使用jQuery UI
相关特性包括两个部分:
- DOM Helper
- Events
包括:
- .animate:使用CSS3动画效果,如果不支持则fallback到javascript的实现方式
- .compare:比较俩个元素的位置
- . formParams:数据data的序列化
- 事件操作:drag,drop,hover,pause,resize,swipe等等
更多内容请查看jQuery++的官方文档。
对于这个类库,你可以完整下载,也可以自定义自己需要的下载功能。希望大家能够喜欢!
来源:jQuery的实用特性扩展类库:jQuery++
[3] 自定义ViewGroup兑现自动换行的布局
来源: 互联网 发布时间: 2014-02-18
自定义ViewGroup实现自动换行的布局
viewgroup简单说就是可以装view的view.今天遇到一个问题,就是需要一个可以自动根据一行中view的宽度自动换行的布局,网上找了下,没有相关的例子,但是找到了思路:自定义一个viewgroup,然后在onlayout文件里面自动检测view的右边缘的横坐标值,和你的view的parent view的况度判断是否换行显示view就可以了。因为代码比较简单,就不多说了:
这里有个地方要注意,那就要明白ViewGroup的绘图流程:ViewGroup绘制包括两个步骤:1.measure 2.layout
在两个步骤中分别调用回调函数:1.onMeasure() 2.onLayout()
1.onMeasure() 在这个函数中,ViewGroup会接受childView的请求的大小,然后通过childView的 measure(newWidthMeasureSpec, heightMeasureSpec)函数存储到childView中,以便childView的getMeasuredWidth() andgetMeasuredHeight() 的值可以被后续工作得到。
2.onLayout() 在这个函数中,ViewGroup会拿到childView的getMeasuredWidth() andgetMeasuredHeight(),用来布局所有的childView。
3.View.MeasureSpec 与 LayoutParams 这两个类,是ViewGroup与childView协商大小用的。其中,View.MeasureSpec是ViewGroup用来部署 childView用的, LayoutParams是childView告诉ViewGroup 我需要多大的地方。
4.在View 的onMeasure的最后要调用setMeasuredDimension()这个方法存储View的大小,这个方法决定了当前View的大小。
http://www.cnblogs.com/slider/archive/2011/11/24/2262161.html
还可以试试这个:
How to Implement Flipboard Animation on Android
viewgroup简单说就是可以装view的view.今天遇到一个问题,就是需要一个可以自动根据一行中view的宽度自动换行的布局,网上找了下,没有相关的例子,但是找到了思路:自定义一个viewgroup,然后在onlayout文件里面自动检测view的右边缘的横坐标值,和你的view的parent view的况度判断是否换行显示view就可以了。因为代码比较简单,就不多说了:
public class MyViewGroup extends ViewGroup {
private final static String TAG = "MyViewGroup";
private final static int VIEW_MARGIN=2;
public MyViewGroup(Context context) {
super(context);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
Log.d(TAG, "widthMeasureSpec = "+widthMeasureSpec+" heightMeasureSpec"+heightMeasureSpec);
for (int index = 0; index < getChildCount(); index++) {
final View child = getChildAt(index);
// measure
child.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
protected void onLayout(boolean arg0, int arg1, int arg2, int arg3, int arg4) {
Log.d(TAG, "changed = "+arg0+" left = "+arg1+" top = "+arg2+" right = "+arg3+" botom = "+arg4);
final int count = getChildCount();
int row=0;// which row lay you view relative to parent
int lengthX=arg1; // right position of child relative to parent
int lengthY=arg2; // bottom position of child relative to parent
for(int i=0;i<count;i++){
final View child = this.getChildAt(i);
int width = child.getMeasuredWidth();
int height = child.getMeasuredHeight();
lengthX+=width+VIEW_MARGIN;
lengthY=row*(height+VIEW_MARGIN)+VIEW_MARGIN+height+arg2;
//if it can't drawing on a same line , skip to next line
if(lengthX>arg3){
lengthX=width+VIEW_MARGIN+arg1;
row++;
lengthY=row*(height+VIEW_MARGIN)+VIEW_MARGIN+height+arg2;
}
child.layout(lengthX-width, lengthY-height, lengthX, lengthY);
}
}
}
这里有个地方要注意,那就要明白ViewGroup的绘图流程:ViewGroup绘制包括两个步骤:1.measure 2.layout
在两个步骤中分别调用回调函数:1.onMeasure() 2.onLayout()
1.onMeasure() 在这个函数中,ViewGroup会接受childView的请求的大小,然后通过childView的 measure(newWidthMeasureSpec, heightMeasureSpec)函数存储到childView中,以便childView的getMeasuredWidth() andgetMeasuredHeight() 的值可以被后续工作得到。
2.onLayout() 在这个函数中,ViewGroup会拿到childView的getMeasuredWidth() andgetMeasuredHeight(),用来布局所有的childView。
3.View.MeasureSpec 与 LayoutParams 这两个类,是ViewGroup与childView协商大小用的。其中,View.MeasureSpec是ViewGroup用来部署 childView用的, LayoutParams是childView告诉ViewGroup 我需要多大的地方。
4.在View 的onMeasure的最后要调用setMeasuredDimension()这个方法存储View的大小,这个方法决定了当前View的大小。
http://www.cnblogs.com/slider/archive/2011/11/24/2262161.html
还可以试试这个:
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
/**
*
* @author RAW
*/
public class FlowLayout extends ViewGroup {
private final static int PAD_H = 2, PAD_V = 2; // Space between child views.
private int mHeight;
public FlowLayout(Context context) {
super(context);
}
public FlowLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
assert (MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.UNSPECIFIED);
final int width = MeasureSpec.getSize(widthMeasureSpec) - getPaddingLeft() - getPaddingRight();
int height = MeasureSpec.getSize(heightMeasureSpec) - getPaddingTop() - getPaddingBottom();
final int count = getChildCount();
int xpos = getPaddingLeft();
int ypos = getPaddingTop();
int childHeightMeasureSpec;
if(MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST)
childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST);
else
childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
mHeight = 0;
for(int i = 0; i < count; i++) {
final View child = getChildAt(i);
if(child.getVisibility() != GONE) {
child.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), childHeightMeasureSpec);
final int childw = child.getMeasuredWidth();
mHeight = Math.max(mHeight, child.getMeasuredHeight() + PAD_V);
if(xpos + childw > width) {
xpos = getPaddingLeft();
ypos += mHeight;
}
xpos += childw + PAD_H;
}
}
if(MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.UNSPECIFIED) {
height = ypos + mHeight;
} else if(MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) {
if(ypos + mHeight < height) {
height = ypos + mHeight;
}
}
height += 5; // Fudge to avoid clipping bottom of last row.
setMeasuredDimension(width, height);
} // end onMeasure()
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
final int width = r - l;
int xpos = getPaddingLeft();
int ypos = getPaddingTop();
for(int i = 0; i < getChildCount(); i++) {
final View child = getChildAt(i);
if(child.getVisibility() != GONE) {
final int childw = child.getMeasuredWidth();
final int childh = child.getMeasuredHeight();
if(xpos + childw > width) {
xpos = getPaddingLeft();
ypos += mHeight;
}
child.layout(xpos, ypos, xpos + childw, ypos + childh);
xpos += childw + PAD_H;
}
}
} // end onLayout()
}
How to Implement Flipboard Animation on Android
最新技术文章: