Skip to content

Instantly share code, notes, and snippets.

@xxxzhi
xxxzhi / setVisibility
Last active October 20, 2016 02:28
use handler to deal with the invalid when setVisibility(View.GONE). At most time ,if the view is under use,setVisibility will be useless.
Message.obtain(handler,new Runnable() {
@Override
public void run() {
System.out.println("gone");
viewGroup.getChildAt(i).clearAnimation(); // this is very imporant! clear animation
for(int i=0;i!=viewGroup.getChildCount();++i){
if(viewGroup.getChildAt(i).getId() == id){
viewGroup.getChildAt(i).setVisibility(View.VISIBLE);
}else{
@xxxzhi
xxxzhi / AudioOpeateIterface
Created October 30, 2013 08:53
监听ImageView 实现按住弹出popwindow 说话,可设置上滑还是下滑取消说话
public interface AudioOpeateIterface{
public void setPlayCompletionListener(MediaPlayer.OnCompletionListener listener);
public void playRecord(String src);
public void startRecord();
public String stopRecord();
public void deleteRecord();
@xxxzhi
xxxzhi / 0_reuse_code.js
Created October 29, 2013 06:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@xxxzhi
xxxzhi / gist:7209875
Created October 29, 2013 06:18
turn the view to bitmap
linear.setDrawingCacheEnabled(true);
//you could not use this.
//linear.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
// MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
//linear.layout(0, 0, linear.getMeasuredWidth(), linear.getMeasuredHeight());
linear.buildDrawingCache();
//获取显示的内容当成图片来显示。
iv.setImageBitmap(linear.getDrawingCache());