Home > Mobile >  Toast the custom for a bosses, help me.
Toast the custom for a bosses, help me.

Time:03-31

BBS around a circle, still can't solve,

ImportClass (" android. Graphics. The drawable. NinePatchDrawable ")
ImportClass (" android content. the Context ")
ImportClass (" android. Graphics. Bitmap ")
ImportClass (" android. Graphics. BitmapFactory ")
ImportClass (" android. Graphics. NinePatch ")
ImportClass (" android OS. Bundle ")
ImportClass (" android. Graphics. The Rect ")
//picture needs. 9. PNG format
Var imgPath="../res/03.9 PNG ";
ImgPath=files. The path (imgPath)


The function setBackground (view, path) {
Bitmap=BitmapFactory. DecodeFile (path)
The chunk=bitmap. GetNinePatchChunk ();
NPD=new NinePatchDrawable (context) getResources (), bitmap, the chunk, new the Rect (), null);
The setBackground (NPD);
}

Var bubble=function Toast9Patch (STR) {
ImportClass (android widgets. Toast);
ImportClass (android. The Gravity);
ImportClass (android. Graphics. Color);
ImportPackage (android. Content);
//LENGTH_SHORT
Var=toast toast. MakeText (context, "", toast. LENGTH_SHORT);

View=UI. Inflate (
<frame & gt;
W="auto" id='_text'
PaddingTop="140 px" paddingLeft="115 px" paddingRight="80 px" paddingBottom="35 px"
Gravity="center | bottom" textColor="# FFFFFF"
/& gt;
, null)
The _text. SetText (STR)
//background
SetBackground (the _text imgPath);
//view
Toast. SetView (view);
Toast. The show ();
SetTimeout (function () {toast. The cancel (); }, 2000)


}

Bubbles (" 1 ")
Sleep (1000)
//not suspend operation, 1 was suspended for 2 plus,
Air bubbles (" 2 ")
//want to effect, toast shows two seconds, the first reality for a second time will be the second top off, the second for two seconds, when the sleep () more than two seconds, display the first first, after the show the second,

CodePudding user response:

Oh my god, I really cracked Chinese code

CodePudding user response:

Can use setDuration this ah

CodePudding user response:

reference 1st floor can't write code monkey reply:
oh my god, Chinese code I really cracked

I want to make to the effect of Chinese is expression,

CodePudding user response:

refer to the second floor can't write code monkey reply:
can use setDuration this

You will write you more ah, you added this code or useless,
ImportClass (" android. Graphics. The drawable. NinePatchDrawable ")
ImportClass (" android content. the Context ")
ImportClass (" android. Graphics. Bitmap ")
ImportClass (" android. Graphics. BitmapFactory ")
ImportClass (" android. Graphics. NinePatch ")
ImportClass (" android OS. Bundle ")
ImportClass (" android. Graphics. The Rect ")

Var imgPath="../res/03.9 PNG ";
ImgPath=files. The path (imgPath)


The function setBackground (view, path) {
Bitmap=BitmapFactory. DecodeFile (path)
The chunk=bitmap. GetNinePatchChunk ();
NPD=new NinePatchDrawable (context) getResources (), bitmap, the chunk, new the Rect (), null);
The setBackground (NPD);
}

Var bubble=function Toast9Patch (STR) {
ImportClass (android widgets. Toast);
ImportClass (android. The Gravity);
ImportClass (android. Graphics. Color);
ImportPackage (android. Content);
//LENGTH_SHORT
Var=toast toast. MakeText (context, "", toast. LENGTH_SHORT);

View=UI. Inflate (
<frame & gt;
W="auto" id='_text'
PaddingTop="140 px" paddingLeft="115 px" paddingRight="80 px" paddingBottom="35 px"
Gravity="center | bottom" textColor="# FFFFFF"
/& gt;
, null)
The _text. SetText (STR)
//background
SetBackground (the _text imgPath);
//view
Toast. SetView (view);
Toast. The show ();
//setTimeout (function () {toast. The cancel (); }, 2000)
Toast. SetDuration (2000)

}

Bubbles (" 1 ")
Sleep (2000)
Bubbles (" 3 ")

CodePudding user response:

I where also defines the wrong?

CodePudding user response:

You have toast. SetDuration (2000) on the toast. The show (); In front of the

CodePudding user response:

refer to 6th floor can't write code monkey reply:
your toast. SetDuration (2000) on the toast. The show (); The

Is still the same, the first stop didn't show 2000 milliseconds, according to the second,

CodePudding user response:

I see what you mean, you use threads to timing, toast in the handle,

CodePudding user response:

Or use the timer timer interval is set to 2 s

CodePudding user response:

The
reference can't write code monkey on the eighth floor response:
I see what you mean, you use threads to timing, toast in the handle,

I question how to deal with it? Baidu all through, not solve,

CodePudding user response:

 
The import android. The annotation. SuppressLint;
The import android. The content. The Context;
The import android. OS. Handler;
The import android. OS. The Message;
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related