本文整理匯總了Java中android.widget.TextView.startAnimation方法的典型用法代碼示例。如果您正苦於以下問題:Java TextView.startAnimation方法的具體用法?Java TextView.startAnimation怎麽用?Java TextView.startAnimation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.TextView
的用法示例。
在下文中一共展示了TextView.startAnimation方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
iv=(ImageView)findViewById(R.id.imageView1);
tv=(TextView)findViewById(R.id.textView1);
animFadeOut=AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_out);
animfadein=AnimationUtils.loadAnimation(getApplicationContext(), R.anim.together);
animFadeOut.setAnimationListener(this);
animfadein.setAnimationListener(this);
iv.startAnimation(animfadein);
tv.startAnimation(animFadeOut);
h= new Handler();
h.postDelayed(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
finish();
if(!bbp)
{
Intent intent =new Intent(Splash.this,MainActivity.class);
Splash.this.startActivity(intent);
}
}
}, holding);
}
示例2: applyLoopAnimation
import android.widget.TextView; //導入方法依賴的package包/類
/**
* Start Loop animation on given list of characters
*/
public long applyLoopAnimation(List<TextView> targetList) {
long duration = (long) (CHARACTER_ANIM_DURATION * 5f);
for (final TextView target : targetList) {
AnimationSet set = new AnimationSet(true);
if (headerLoopAnim == HeaderLoopAnim.ZOOM) {
addLoopScaleAnimations(duration, set);
} else if (headerLoopAnim == HeaderLoopAnim.FADE) {
addLoopFadeAnimations(duration, set);
}
target.startAnimation(set);
}
// loop anim iteration
currentLoopIteration = (currentLoopIteration + 1) % headerLoopAnimIteration;
return (long) ((duration * 2.1f) + 300);
}
示例3: onCreate
import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.whats_door);
mLeft = (ImageView)findViewById(R.id.imageLeft);
mRight = (ImageView)findViewById(R.id.imageRight);
mText = (TextView)findViewById(R.id.anim_text);
AnimationSet anim = new AnimationSet(true);
TranslateAnimation mytranslateanim = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,-1f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f);
mytranslateanim.setDuration(2000);
anim.setStartOffset(800);
anim.addAnimation(mytranslateanim);
anim.setFillAfter(true);
mLeft.startAnimation(anim);
AnimationSet anim1 = new AnimationSet(true);
TranslateAnimation mytranslateanim1 = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,+1f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f);
mytranslateanim1.setDuration(1500);
anim1.addAnimation(mytranslateanim1);
anim1.setStartOffset(800);
anim1.setFillAfter(true);
mRight.startAnimation(anim1);
AnimationSet anim2 = new AnimationSet(true);
ScaleAnimation myscaleanim = new ScaleAnimation(1f,3f,1f,3f,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
myscaleanim.setDuration(1000);
AlphaAnimation myalphaanim = new AlphaAnimation(1,0.0001f);
myalphaanim.setDuration(1500);
anim2.addAnimation(myscaleanim);
anim2.addAnimation(myalphaanim);
anim2.setFillAfter(true);
mText.startAnimation(anim2);
new Thread(this).start();
}
示例4: onCreate
import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tvPulsa = (TextView) findViewById(R.id.tvPulsa);
rl = (RelativeLayout) findViewById(R.id.activity_main);
animation = AnimationUtils.loadAnimation(this, R.anim.fadeinout);
tvPulsa.startAnimation(animation);
rl.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Intent intent = new Intent(MainActivity.this, MenuActivity.class);
startActivity(intent);
return true;
}
});
}
示例5: onCreate
import android.widget.TextView; //導入方法依賴的package包/類
@Override
@SuppressLint("SetJavaScriptEnabled")
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web);
WebView webView = (WebView) findViewById(R.id.web_view);
String url = getIntent().getStringExtra(URL);
if (url == null && getIntent().getData() != null) {
url = getIntent().getData().getQueryParameter(URL);
}
if (url == null) {
finish();
}
webView.setWebViewClient(new InnerWebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(url);
loading = (TextView) findViewById(R.id.loading);
Animation animation = new ScaleAnimation(1.0f, 1.2f, 1.0f, 1.2f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animation.setRepeatMode(Animation.REVERSE);
animation.setRepeatCount(Animation.INFINITE);
animation.setDuration(500);
loading.startAnimation(animation);
setTitle(url);
}
示例6: instantiateItem
import android.widget.TextView; //導入方法依賴的package包/類
@Override
public Object instantiateItem(ViewGroup container, int position) {
if (bound == null || bound.getBridges().size() <= position) {
Log.w(TAG, "Activity not bound when creating TerminalView.");
}
TerminalBridge bridge = bound.getBridges().get(position);
bridge.promptHelper.setHandler(promptHandler);
// inflate each terminal view
RelativeLayout view = (RelativeLayout) inflater.inflate(
R.layout.item_terminal, container, false);
// set the terminal name overlay text
TextView terminalNameOverlay = (TextView) view.findViewById(R.id.terminal_name_overlay);
terminalNameOverlay.setText(bridge.host.getNickname());
// and add our terminal view control, using index to place behind overlay
final TerminalView terminal = new TerminalView(container.getContext(), bridge, pager);
terminal.setId(R.id.terminal_view);
view.addView(terminal, 0);
// Tag the view with its bridge so it can be retrieved later.
view.setTag(bridge);
container.addView(view);
terminalNameOverlay.startAnimation(fade_out_delayed);
return view;
}
示例7: onClick
import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void onClick(View view) {
//Extract values from children
LinearLayout rowsView = (LinearLayout) rootView.findViewById(R.id.repeatable_items);
ArrayList<String> row = new ArrayList<>();
for (int i = 0; i < rowsView.getChildCount(); ++i) {
EditText et = (EditText) rowsView.getChildAt(i).findViewById(R.id.input_row);
row.add(et.getText().toString());
}
fq.addRow(row);
TextView tvCount = (TextView) rootView.findViewById(R.id.question_items_count);
tvCount.setText(fq.getRows().size() + " items");
Toast.makeText(FormSolverActivity.this, "SAVED", Toast.LENGTH_SHORT).show();
Animation animation = new ScaleAnimation(1,1.1f,1,1.1f);
animation.setDuration(300);
animation.setRepeatMode(Animation.REVERSE);
animation.setRepeatCount(1);
tvCount.startAnimation(animation);
//Remove any child from view
((LinearLayout) rootView.findViewById(R.id.repeatable_items)).removeAllViews();
((Button) rootView.findViewById(R.id.question_add_response_instance)).setText(getString(R.string.action_new_row));
rootView.findViewById(R.id.question_add_response_instance).setOnClickListener(new onRowAddedListener(rootView, fq));
fab.show();
}
示例8: percentageClick
import android.widget.TextView; //導入方法依賴的package包/類
protected void percentageClick(Button button,TextView title,
TextView currMax, View v){
final Animation percentAnimation = AnimationUtils.loadAnimation
(currMax.getContext(), android.R.anim.fade_in);
String liftName = MaxesFragment.createValidString(title.getText().toString()
.toLowerCase().trim());
DBHandler db = new DBHandler(v.getContext(), liftName);
float newWeight, oldWeight = findLastValue(db, liftName);
float percentage = Float.parseFloat(button.getText().toString())/100;
newWeight = Math.round((((oldWeight*percentage)-45)/2));
currMax.startAnimation(percentAnimation);
currMax.setText(String.valueOf(newWeight));
db.close();
}
示例9: onCreate
import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.bloodtype);
prefs = this.getSharedPreferences("BloodType", Context.MODE_PRIVATE);
strAndroidInfo = prefs.getString("BloodVal", "");
inPrefConv = Integer.parseInt(strAndroidInfo);
tvG = (TextView) findViewById(R.id.tvGiveTo);
tvR = (TextView) findViewById(R.id.tvReceiveFrom);
tvB = (TextView) findViewById(R.id.tvBloodDetail);
tvB.setText(strBloodType[inPrefConv]);
tvD = (TextView) findViewById(R.id.tvData);
tvD.setTypeface(Typeface.createFromAsset(BloodType.this.getAssets(), "fonts/gbold.otf"));
tvA = (TextView) findViewById(R.id.tvGive);
tvC = (TextView) findViewById(R.id.tvReceive);
animAnticipateOvershoot = AnimationUtils.loadAnimation(this, R.anim.overshoot);
tvB.startAnimation(animAnticipateOvershoot);
animAnticipateOvershootX = AnimationUtils.loadAnimation(this, R.anim.overshootx);
tvC.startAnimation(animAnticipateOvershootX);
tvA.startAnimation(animAnticipateOvershootX);
//Handler handler = new Handler();
//handler.postDelayed(task, 1000);
PerformBloodCheck(inPrefConv);
getActionBar().setDisplayHomeAsUpEnabled(true);
}
示例10: onCreate
import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
tv = (TextView) findViewById(R.id.tv);
iv = (ImageView) findViewById(R.id.iv);
Animation myanim = AnimationUtils.loadAnimation(this, R.anim.mytrasition);
tv.startAnimation(myanim);
iv.startAnimation(myanim);
final Intent i = new Intent(this, Activity_login.class);
Thread timer = new Thread(){
public void run(){
try{
sleep(5000);}
catch (Exception e){
System.out.println(e.getMessage());
e.printStackTrace();
}finally {
startActivity(i);
finish();
}
}
};
timer.start();
}
示例11: onCreate
import android.widget.TextView; //導入方法依賴的package包/類
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_score);
tv=(TextView) findViewById(R.id.textView2);
v=(TextView) findViewById(R.id.textView3);
vt=(TextView) findViewById(R.id.textView1);
Intent i=getIntent();
int score=i.getIntExtra("s", 0);
String result=i.getStringExtra("result");
tv.setText("Score = "+score);
v.setText(result);
v.startAnimation((Animation)AnimationUtils.loadAnimation(this, R.anim.translate));
}
示例12: onCreateView
import android.widget.TextView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_app, null);
mViewPager = (ViewPager) view.findViewById(R.id.app_view_pager);
pointer = (TextView) view.findViewById(R.id.app_pointer);
initAnimation();
pointer.startAnimation(rotation);
initAllApp();
mViewPager.setOnPageChangeListener(pageChangeListener);
return view;
}
示例13: applyTextAnimation
import android.widget.TextView; //導入方法依賴的package包/類
/**
* Start animations on characters
*/
public long applyTextAnimation(final TextView target) {
final long duration = (long) (CHARACTER_ANIM_DURATION * 2.1f);
if (isColorAnimEnable && colorAnimationArray != null) {
final ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), originalColor, colorAnimationArray[colorIndex]);
colorAnimation.setDuration(duration);
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
target.setTextColor((Integer) animator.getAnimatedValue());
}
});
colorAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
target.setTextColor(originalColor);
}
});
colorAnimation.start();
// loop though color array
colorIndex = (colorIndex + 1) % colorAnimationArray.length;
}
AnimationSet set = new AnimationSet(true);
if (headerTextAnim == HeaderTextAnim.ROTATE_CW) {
ROTATION_ANGLE = 20.0f;
addTextRotateAnimations(set);
} else if (headerTextAnim == HeaderTextAnim.ROTATE_ACW) {
ROTATION_ANGLE = -20.0f;
addTextRotateAnimations(set);
} else if (headerTextAnim == HeaderTextAnim.FADE) {
addTextFadeAnimations(set);
} else if (headerTextAnim == HeaderTextAnim.ZOOM) {
addTextZoomAnimations(set);
}
target.startAnimation(set);
// text anim iteration
currentTextIteration = (currentTextIteration + 1) % headerTextAnimIteration;
return duration + CHARACTER_ANIM_DURATION;
}
示例14: initLoadView
import android.widget.TextView; //導入方法依賴的package包/類
private void initLoadView(Activity activity) {
View loadView=hashMap_activity_loadView.get(activity);
LinearLayout loadretry_parent=(LinearLayout)loadView.findViewById(R.id.loadretry_parent);
GifImageView gifImageView=(GifImageView)loadView.findViewById(R.id.loadretry_gifview);
TextView tv_error=(TextView)loadView.findViewById(R.id.loadretry_tv_error);
AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
alphaAnimation.setDuration(loadRetryRefreshConfig.getStartAnimTime());
gifImageView.startAnimation(alphaAnimation);
tv_error.startAnimation(alphaAnimation);
gifImageView.setVisibility(View.VISIBLE);
tv_error.setVisibility(View.VISIBLE);
RTextView tv_retry=(RTextView)loadView.findViewById(R.id.loadretry_tv_retry);
tv_retry.setVisibility(View.INVISIBLE);
if (loadRetryRefreshConfig !=null){
if (loadRetryRefreshConfig.getGif()!=0){
setGifImageView(activity,gifImageView,false);
}
if (loadRetryRefreshConfig.getBackgroundColor()!=0){
loadretry_parent.setBackgroundColor(activity.getResources().getColor(loadRetryRefreshConfig.getBackgroundColor()));
}
if (loadRetryRefreshConfig.getBtnBorderColor()!=0){
tv_retry.setBorderColorNormal(activity.getResources().getColor(loadRetryRefreshConfig.getBtnBorderColor()));
tv_retry.setBorderColorPressed(activity.getResources().getColor(loadRetryRefreshConfig.getBtnBorderColor()));
tv_retry.setBorderWidthNormal(dip2px(activity,1));
tv_retry.setBorderWidthPressed(dip2px(activity,1));
}
if (loadRetryRefreshConfig.getBtnNormalColor()!=0&& loadRetryRefreshConfig.getBtnPressedColor()!=0){
tv_retry.setBackgroundColorNormal(activity.getResources().getColor(loadRetryRefreshConfig.getBtnNormalColor()));
tv_retry.setBackgroundColorPressed(activity.getResources().getColor(loadRetryRefreshConfig.getBtnPressedColor()));
}
if (loadRetryRefreshConfig.getBtnRadius()!=null){
tv_retry.setCornerRadius(loadRetryRefreshConfig.getBtnRadius());
}
if (loadRetryRefreshConfig.getBtnTextColor()!=0){
tv_retry.setTextColor(activity.getResources().getColor(loadRetryRefreshConfig.getBtnTextColor()));
}
if (!TextUtils.isEmpty(loadRetryRefreshConfig.getBtnText())){
tv_retry.setText(loadRetryRefreshConfig.getBtnText());
}
if (loadRetryRefreshConfig.getLoadAndErrorTextColor()!=0){
tv_error.setTextColor(activity.getResources().getColor(loadRetryRefreshConfig.getLoadAndErrorTextColor()));
}
if (!TextUtils.isEmpty(loadRetryRefreshConfig.getLoadText())){
tv_error.setText(loadRetryRefreshConfig.getLoadText());
}
}
}
示例15: startAnimation
import android.widget.TextView; //導入方法依賴的package包/類
public static void startAnimation(Activity activity, int selectNum, View startView, View endView) {
TextView textView = new TextView(activity);
ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
LinearLayout animLayout = new LinearLayout(activity);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
animLayout.setLayoutParams(lp);
animLayout.setBackgroundResource(android.R.color.transparent);
decorView.addView(animLayout);
textView.setTextColor(Color.WHITE);
textView.setText(String.valueOf(selectNum));
textView.setBackground(ContextCompat.getDrawable(activity, R.drawable.image_select));
textView.setGravity(Gravity.CENTER);
animLayout.addView(textView);
int[] locs = new int[2];
endView.getLocationInWindow(locs);
int[] loc2 = new int[2];
startView.getLocationInWindow(loc2);
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
textParams.leftMargin = loc2[0];
textParams.topMargin = loc2[1];
textView.setLayoutParams(textParams);
Animation topTranslateAnimation = new TranslateAnimation(0, (locs[0] - loc2[0]) / 3, 0, (locs[1] - loc2[1]) / 3);
topTranslateAnimation.setDuration(1000);
topTranslateAnimation.setInterpolator(activity, android.R.anim.linear_interpolator);
topTranslateAnimation.setFillAfter(false);
Animation alphaAnimation = new AlphaAnimation(1, 0);
alphaAnimation.setDuration(1000);
AnimationSet animationSet = new AnimationSet(false);
animationSet.addAnimation(topTranslateAnimation);
animationSet.addAnimation(alphaAnimation);
animationSet.setFillAfter(true);
textView.startAnimation(animationSet);
}