- 浏览: 204046 次
- 性别:
- 来自: 大连
文章分类
- 全部博客 (54)
- java (17)
- hibernate (3)
- javascript (6)
- Ajax (1)
- 插件 (2)
- 数据库 (3)
- html+css+div (5)
- 其他程序 (3)
- 应用技术 (18)
- office (0)
- 小工具 (1)
- 加密解密 (3)
- mac (3)
- 翻译 (1)
- iphone objectc (5)
- iphone (4)
- android (12)
- 圆角 (1)
- layout (2)
- 加密 (1)
- proguard (2)
- Mac 应用技术 系统 工具 (2)
- Mac 应用技术 系统 工具,xcode4 (1)
- 安卓 (6)
- maven (3)
- 高德 (1)
- 地图 (1)
- lrzsz (1)
- rz (1)
- sz (1)
- 脚本 (1)
- linux (1)
- Android Gradle (1)
- Spark (1)
- mongodb (1)
最新评论
-
Jumper_Wu:
想请教个问题:so文件从maven库中拉到AndroidStu ...
在maven android 工程中使用高德地图 -
cuiqi4016:
可不可以把把html模版作为一个单独的文件引入进来,handl ...
Handlebars 的使用 -
lywangbadan:
Handlebars 的使用 -
lituo20:
不错的,以前接触过一点,看了一下,恍然大悟,好像一下子懂了
Handlebars 的使用 -
zhangyaochun:
其实就是模板化,这是以前就开始推崇的面向数据编程的一个方式。比 ...
Handlebars 的使用
public class ActionSheet implements OnClickListener {
private Context context;
private LinearLayout layout;
private View actionsheetView;
private TextView title;
private Button deleteButton, cancelButton;
private ActionSheetButtonClickListener aslistener;
/**
* This creates a ActionSheet
* @param context
* @param layout
*/
public ActionSheet(Context context, LinearLayout layout) {
this.context = context;
this.layout = layout;
init();
}
private void init() {
LayoutInflater inflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.actionsheetView = inflater.inflate(R.layout.action_sheet, null);
this.deleteButton = (Button) this.actionsheetView.findViewById(R.id.action_sheet_delete);
this.cancelButton = (Button) this.actionsheetView.findViewById(R.id.action_sheet_cancel);
this.title = (TextView) this.actionsheetView.findViewById(R.id.action_sheet_title);
}
/**
* This
* @param listener
*/
public void setOnButtonClickListener(ActionSheetButtonClickListener listener) {
this.aslistener = listener;
}
/**
* This action sheet
* @param title
*/
public void show(String title) {
this.title.setText(title);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_APPLICATION, WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
PixelFormat.TRANSLUCENT);
this.deleteButton.setOnClickListener(this);
this.cancelButton.setOnClickListener(this);
this.actionsheetView.setSoundEffectsEnabled(false);
this.actionsheetView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
hide();
}
});
this.layout.addView(this.actionsheetView, lp);
Animation animIn = AnimationUtils.loadAnimation(this.context, R.anim.push_up_in);
animIn.setDuration(200);
animIn.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
Activity parent = (Activity) ActionSheet.this.context;
// using the activity, get Window reference
// Window window = parent.getWindow();
parent.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
parent.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
TransitionDrawable transition = (TransitionDrawable) ActionSheet.this.actionsheetView.getBackground();
transition.startTransition(100);
}
});
this.actionsheetView.setAnimation(animIn);
this.layout.bringChildToFront(this.actionsheetView);
}
/**
* This hide action sheet
*/
public void hide() {
Animation animOut = AnimationUtils.loadAnimation(this.context, R.anim.push_down_out);
animOut.setDuration(200);
animOut.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
TransitionDrawable transition = (TransitionDrawable) ActionSheet.this.actionsheetView.getBackground();
transition.resetTransition();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
ActionSheet.this.layout.removeView(ActionSheet.this.actionsheetView);
}
});
this.actionsheetView.setAnimation(animOut);
this.actionsheetView.startAnimation(animOut);
}
/**
* {@inheritDoc}
* @see android.view.View.OnClickListener#onClick(android.view.View)
*/
@Override
public void onClick(View v) {
if (v.getId() == R.id.action_sheet_delete) {
this.aslistener.onButtonClick(this, 0);
} else {
this.aslistener.onButtonClick(this, 1);
}
}
}
public interface ActionSheetButtonClickListener {
/**
* This actionsheet button call back
* @param index
*/
public void onButtonClick(ActionSheet actionsheet, int index);
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/action_sheet_background"
android:gravity="bottom"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/action_sheet_bg"
android:gravity="center_horizontal"
android:orientation="vertical" >
<TextView
android:id="@+id/action_sheet_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:textColor="@color/white"
android:textSize="20dp" />
<Button
android:id="@+id/action_sheet_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@drawable/action_sheet_delete_button"
android:text="@string/fav_action_sheet_delete"
android:textColor="@color/black"
android:textSize="20dp" />
<Button
android:id="@+id/action_sheet_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/action_sheet_cancel_button"
android:text="@string/cancel"
android:textColor="@color/white"
android:textSize="20dp" />
</LinearLayout>
</LinearLayout>
action_sheet_bg
<?xml version="1.0" encoding="utf-8"?>
<transition xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- The drawables used here can be solid colors, gradients, shapes, images, etc. -->
<item android:drawable="@android:color/transparent"/>
<item android:drawable="@color/action_sheet_background"/>
</transition>
action_sheet_cancel_button
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/action_sheet_delete_clicked" android:state_pressed="true"/> <!-- pressed -->
<item android:drawable="@drawable/action_sheet_delete_clicked" android:state_focused="true"/> <!-- focused -->
<item android:drawable="@drawable/action_sheet_delete"/> <!-- default -->
</selector>
action_sheet_delete_button
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/action_sheet_cancel_clicked" android:state_pressed="true"/> <!-- pressed -->
<item android:drawable="@drawable/action_sheet_cancel_clicked" android:state_focused="true"/> <!-- focused -->
<item android:drawable="@drawable/action_sheet_cancel"/> <!-- default -->
</selector>
private Context context;
private LinearLayout layout;
private View actionsheetView;
private TextView title;
private Button deleteButton, cancelButton;
private ActionSheetButtonClickListener aslistener;
/**
* This creates a ActionSheet
* @param context
* @param layout
*/
public ActionSheet(Context context, LinearLayout layout) {
this.context = context;
this.layout = layout;
init();
}
private void init() {
LayoutInflater inflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
this.actionsheetView = inflater.inflate(R.layout.action_sheet, null);
this.deleteButton = (Button) this.actionsheetView.findViewById(R.id.action_sheet_delete);
this.cancelButton = (Button) this.actionsheetView.findViewById(R.id.action_sheet_cancel);
this.title = (TextView) this.actionsheetView.findViewById(R.id.action_sheet_title);
}
/**
* This
* @param listener
*/
public void setOnButtonClickListener(ActionSheetButtonClickListener listener) {
this.aslistener = listener;
}
/**
* This action sheet
* @param title
*/
public void show(String title) {
this.title.setText(title);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_APPLICATION, WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
PixelFormat.TRANSLUCENT);
this.deleteButton.setOnClickListener(this);
this.cancelButton.setOnClickListener(this);
this.actionsheetView.setSoundEffectsEnabled(false);
this.actionsheetView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
hide();
}
});
this.layout.addView(this.actionsheetView, lp);
Animation animIn = AnimationUtils.loadAnimation(this.context, R.anim.push_up_in);
animIn.setDuration(200);
animIn.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
Activity parent = (Activity) ActionSheet.this.context;
// using the activity, get Window reference
// Window window = parent.getWindow();
parent.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
parent.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
TransitionDrawable transition = (TransitionDrawable) ActionSheet.this.actionsheetView.getBackground();
transition.startTransition(100);
}
});
this.actionsheetView.setAnimation(animIn);
this.layout.bringChildToFront(this.actionsheetView);
}
/**
* This hide action sheet
*/
public void hide() {
Animation animOut = AnimationUtils.loadAnimation(this.context, R.anim.push_down_out);
animOut.setDuration(200);
animOut.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
TransitionDrawable transition = (TransitionDrawable) ActionSheet.this.actionsheetView.getBackground();
transition.resetTransition();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
ActionSheet.this.layout.removeView(ActionSheet.this.actionsheetView);
}
});
this.actionsheetView.setAnimation(animOut);
this.actionsheetView.startAnimation(animOut);
}
/**
* {@inheritDoc}
* @see android.view.View.OnClickListener#onClick(android.view.View)
*/
@Override
public void onClick(View v) {
if (v.getId() == R.id.action_sheet_delete) {
this.aslistener.onButtonClick(this, 0);
} else {
this.aslistener.onButtonClick(this, 1);
}
}
}
public interface ActionSheetButtonClickListener {
/**
* This actionsheet button call back
* @param index
*/
public void onButtonClick(ActionSheet actionsheet, int index);
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/action_sheet_background"
android:gravity="bottom"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/action_sheet_bg"
android:gravity="center_horizontal"
android:orientation="vertical" >
<TextView
android:id="@+id/action_sheet_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:textColor="@color/white"
android:textSize="20dp" />
<Button
android:id="@+id/action_sheet_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@drawable/action_sheet_delete_button"
android:text="@string/fav_action_sheet_delete"
android:textColor="@color/black"
android:textSize="20dp" />
<Button
android:id="@+id/action_sheet_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/action_sheet_cancel_button"
android:text="@string/cancel"
android:textColor="@color/white"
android:textSize="20dp" />
</LinearLayout>
</LinearLayout>
action_sheet_bg
<?xml version="1.0" encoding="utf-8"?>
<transition xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- The drawables used here can be solid colors, gradients, shapes, images, etc. -->
<item android:drawable="@android:color/transparent"/>
<item android:drawable="@color/action_sheet_background"/>
</transition>
action_sheet_cancel_button
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/action_sheet_delete_clicked" android:state_pressed="true"/> <!-- pressed -->
<item android:drawable="@drawable/action_sheet_delete_clicked" android:state_focused="true"/> <!-- focused -->
<item android:drawable="@drawable/action_sheet_delete"/> <!-- default -->
</selector>
action_sheet_delete_button
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/action_sheet_cancel_clicked" android:state_pressed="true"/> <!-- pressed -->
<item android:drawable="@drawable/action_sheet_cancel_clicked" android:state_focused="true"/> <!-- focused -->
<item android:drawable="@drawable/action_sheet_cancel"/> <!-- default -->
</selector>
发表评论
-
Spark 连接 MongoDB
2018-03-07 09:55 3293Spark 连接 Mongodb 官方地址:https://w ... -
解决android4.0系统中菜单(Menu)添加Icon无效问题
2016-02-16 16:23 947android actionbar menu 显示icon默认 ... -
mac 系统安装rz sz
2015-06-30 11:36 119631.先安装item2,item2 市类似mac风格的终端 ... -
ListView 中嵌套GridView listview item 不能点击问题
2015-03-12 23:28 2051在ListView的item中有GridView,抢占焦点的情 ... -
android 手机传感器
2014-02-18 14:31 1430List<Sensor> sensors = th ... -
android regex utils
2013-12-31 22:43 0public class RegexUtils { pub ... -
Proguard on MacOSX
2013-10-26 23:33 1166[proguard] Error: Can't read [/ ... -
android 自定义progressbar style
2013-09-05 11:22 2668<layer-list xmlns:android=&q ... -
android ADT 17 can not find aapt when build with maven
2013-05-20 23:37 2225更新android adt 版本17之后,程序不能build了 ... -
在maven android 工程中使用高德地图
2013-04-11 21:35 4421由于程序中使用地图,最终选择了高德地图。但是高德地图中需要使用 ... -
android 代码proguard
2013-03-17 13:22 3149大家都知道,java 代码很容易被反编译,同样android ... -
Struts 标签实现时间下来选择
2012-09-13 11:58 1299<select id="min" ... -
MapMarkerExample
2012-04-21 01:21 1291This example show you how to dr ... -
Web browser hacks, Css hacks - ie, firefox, chrome, safri, Opera
2013-04-11 21:35 1071CSS hacks take advantage of bro ... -
Xcode 4 更改下载组件的appleId
2012-04-13 16:40 2443You can change the Apple Develo ... -
Handlebars 的使用
2012-03-31 01:12 33608web 开发中,js 解析JSON 是经常的事情。非常繁琐。h ... -
使用CSS实现间隔线|(竖线)
2012-04-13 16:40 2059是不是考虑用这个? <a href="#&qu ... -
[WARN]Warning: Multiple build commands for output file /
2011-12-13 11:48 9873xcode中 有时候会报一个警告: [WARN]Warning ... -
xcode missing file xxxx
2011-12-13 11:44 4823搞过iphone开发的应该都知道,如果你在finder中删除了 ... -
android 程序 发布加密
2011-12-01 13:37 3208大家都知道,现在java程序很容易就让别人反编译,andori ...
相关推荐
仿iphone软键盘输入文本框是一款基于jQuery CSS3实现的仿制iphone类型软键盘特效。
wpf仿iphone桌面翻页效果,不满足翻页条件则回滚当页,另外增加了左右翻页按钮。
仿IPHONE状态栏
仿iPhone/iPod动态图片浏览器 仿iPhone/iPod动态图片浏览器 仿iPhone/iPod动态图片浏览器
仿iPhone5桌面插件 Fake iPhone 5 v1.2 汉化版,没有iPhone的可以用用哈—Android应用
一个简单的仿iPhone滑动开关的控件,适合项目需要的时候和学习之用,gb编码
仿iphone桌面拖动排序 仿苹果桌面 仿iphone ios桌面 launcher 本人见市场上很少仿排序拖拉这样的算法。所以改android源码。供大家学习使用哦。 这是android仿ios桌面的应用,支持拖动排序。 高仿iphone桌面,排列...
仿IPhone菜单悬浮按钮 仿IPhone菜单悬浮按钮
仿iphone界面的从底部弹出来的自定义菜单,可以按照自己需要增加菜单项,美化菜单界面
android 仿iphone 时钟 clock
见过的android中仿iphone最好的控件,实现下拉刷新 上提加载等功能
安卓仿iPhone控制中心,上划出现控制中心工具栏
仿iphone通讯录源码,跟Iphone 中通讯录很像,对初学者很有帮助
Android 源码高仿IPhone锁屏.zip
仿iPhone手机销售网站,非常完整的模板。
Android源码高仿IPhone锁屏.zip
这是一款android实现的仿iphone Launcher 桌面
iOS仿iphone手机相册手势滑动多选照片功能,手势滑动多选UICollectionView的item
仿iPhone滑屏解锁查看微信代码是一款基于html5实现的仿苹果手机滑屏解锁查看微信代码。
NULL 博文链接:https://dai-lm.iteye.com/blog/1462418