自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(1)
  • 资源 (4)
  • 收藏
  • 关注

原创 Android百度地图获取经纬度和好友定位

1.新建工程,libs目录下导入baidumapapi_v3_0_0.jar和locSDK_4.2.jar架包,so文件也需要导入。     2.关键类说明 public MapView mapView = null;获取地图(视图) public BaiduMap baiduMap = null;获取地图引用控件 public LocationClient l

2014-11-14 10:39:12 1900 1

Neleme-master.zip

Fragment标签切换, FoodBean foodBean = (FoodBean) intent.getSerializableExtra("foodbean"); FoodBean fb = foodBean; int p = intent.getIntExtra("position", -1); if (p >= 0 && p < firstFragment.getFoodAdapter().getItemCount()) { fb = firstFragment.getFoodAdapter().getItem(p); fb.setSelectCount(foodBean.getSelectCount()); firstFragment.getFoodAdapter().setData(p, fb); } else { for (int i = 0; i < firstFragment.getFoodAdapter().getItemCount(); i++) { fb = firstFragment.getFoodAdapter().getItem(i); if (fb.getId() == foodBean.getId()) { fb.setSelectCount(foodBean.getSelectCount()); firstFragment.getFoodAdapter().setData(i, fb); break; } } } dealCar(fb);

2020-03-22

动画从屏幕下方弹出dialog

package com.example.animdialogdemo; import com.example.calculatedemo.R; import android.app.Dialog; import android.content.Context; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class CalculatorDialog extends Dialog implements OnClickListener { private Button[] btn = new Button[10]; private EditText etLed; private Button btnSub, btnPlus, btnEqual, btnDot, btnC, mButton_cancel, btnOk; private double predata = 0; private String preopt = "="; private boolean vbegin = true; private int i = 1; public CalculatorDialog(Context context) { super(context); // TODO Auto-generated constructor stub this.show(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_caclu); findUiById(); addListener(); } private void findUiById() { etLed = (EditText) this.findViewById(R.id.ed_led); btn[0] = (Button) this.findViewById(R.id.mButton0); btn[1] = (Button) this.findViewById(R.id.mButton1); btn[2] = (Button) this.findViewById(R.id.mButton2); btn[3] = (Button) this.findViewById(R.id.mButton3); btn[4] = (Button) this.findViewById(R.id.mButton4); btn[5] = (Button) this.findViewById(R.id.mButton5); btn[6] = (Button) this.findViewById(R.id.mButton6); btn[7] = (Button) this.findViewById(R.id.mButton7); btn[8] = (Button) this.findViewById(R.id.mButton8); btn[9] = (Button) this.findViewById(R.id.mButton9); btnSub = (Button) this.findViewById(R.id.mButton_jia); btnPlus = (Button) this.findViewById(R.id.mButton_jian); btnEqual = (Button) this.findViewById(R.id.mButton_equ); btnDot = (Button) this.findViewById(R.id.mButton_dian); btnC = (Button) findViewById(R.id.mButton_C); btnOk = (Button) this.findViewById(R.id.mButton_ok); mButton_cancel = (Button) this.findViewById(R.id.mButton_cancel); } public void addListener() { for (int i = 0; i < btn.length; i++) { btn[i].setOnClickListener(this); } btnOk.setOnClickListener(this); btnSub.setOnClickListener(this); btnPlus.setOnClickListener(this); btnEqual.setOnClickListener(this); btnDot.setOnClickListener(this); btnC.setOnClickListener(this); mButton_cancel.setOnClickListener(this); } public void onClick(View v) { String command = ((Button) v).getText().toString(); String str = etLed.getText().toString(); if (command.compareTo("bac") == 0) { if (str.length() > 1) { etLed.setText(str.substring(0, str.length() - 1)); } else if (str.length() == 1) { etLed.setText("0"); vbegin = true; } } else if (command.compareTo("C") == 0) { etLed.setText("0"); vbegin = true; predata = 0; preopt = "="; } else if ("0123456789".indexOf(command) != -1) { wtNumber(command); } else if ("+-=".indexOf(command) != -1) { wtOperater(command); } if ("ȷ��".equals(command)) { this.dismiss(); } switch (v.getId()) { case R.id.mButton_cancel: dismiss(); break; default: break; } } private void wtNumber(String str) { if (vbegin) { etLed.setText(str); } else { etLed.append(str); } vbegin = false; } private void wtOperater(String opt) { try { double temp = Double.parseDouble(etLed.getText().toString()); if (vbegin) { preopt = opt; } else { if (preopt.equals("=")) { predata = temp; } else if (preopt.equals("+")) { predata += temp; } } etLed.setText(predata + ""); preopt = opt; } catch (NumberFormatException e) { etLed.setText("����Ϊ0"); } catch (ArithmeticException e) { etLed.setText("����Ϊ0"); preopt = "="; } finally { vbegin = true; } } }

2013-10-25

上下左右滑动效果

public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { // handler.removeCallbacks(runnable);//当滑动图片时,停止自动播放 if (e2.getX() - e1.getX() > 120) { // 从左向右滑动(左进右出) Animation rInAnim = AnimationUtils.loadAnimation(mActivity, R.anim.ug_right_in); // 向右滑动左侧进入的渐变效果(alpha 0.1 -> 1.0) Animation rOutAnim = AnimationUtils.loadAnimation(mActivity, R.anim.ug_right_out); // 向右滑动右侧滑出的渐变效果(alpha 1.0 -> 0.1) viewflipper.setInAnimation(rInAnim); viewflipper.setOutAnimation(rOutAnim); viewflipper.showPrevious(); // 调用该函数来显示FrameLayout里面的上一个View。 System.out.println("往右滑动"); return true; } else if (e2.getX() - e1.getX() < -120) { // 从右向左滑动(右进左出) Animation lInAnim = AnimationUtils.loadAnimation(mActivity, R.anim.ug_left_in); // 向左滑动左侧进入的渐变效果(alpha 0.1 -> 1.0) Animation lOutAnim = AnimationUtils.loadAnimation(mActivity, R.anim.ug_left_out); // 向左滑动右侧滑出的渐变效果(alpha 1.0 -> 0.1) viewflipper.setInAnimation(lInAnim); viewflipper.setOutAnimation(lOutAnim); viewflipper.showNext(); // 调用该函数来显示FrameLayout里面的下一个View。 System.out.println("往左滑动"); return true; } else if (e2.getY() - e1.getY() > 120) { // 从上向下滑动(上进下出) Animation rInAnim = AnimationUtils.loadAnimation(mActivity, R.anim.ug_up_in); // 向右滑动左侧进入的渐变效果(alpha 0.1 -> 1.0) Animation rOutAnim = AnimationUtils.loadAnimation(mActivity, R.anim.ug_up_out); // 向右滑动右侧滑出的渐变效果(alpha 1.0 -> 0.1) viewflipper.setInAnimation(rInAnim); viewflipper.setOutAnimation(rOutAnim); viewflipper.showNext(); // 调用该函数来显示FrameLayout里面的上一个View。 System.out.println("往下滑动"); return true; } else if (e2.getY() - e1.getY() < -120) { // 从下向上滑动(下进上出) Animation lInAnim = AnimationUtils.loadAnimation(mActivity, R.anim.ug_down_in); // 向左滑动左侧进入的渐变效果(alpha 0.1 -> 1.0) Animation lOutAnim = AnimationUtils.loadAnimation(mActivity, R.anim.ug_down_out); // 向左滑动右侧滑出的渐变效果(alpha 1.0 -> 0.1) viewflipper.setInAnimation(lInAnim); viewflipper.setOutAnimation(lOutAnim); viewflipper.showPrevious(); // 调用该函数来显示FrameLayout里面的下一个View。 System.out.println("往上滑动"); return true; } return true; }

2013-10-24

ScrollView瀑布流

使用ScrollView代码编写的瀑布流,不多说了,直接看代码吧!

2013-08-21

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除