安卓仿微信右上角弹出菜单窗口
import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.widget.LinearLayout; import com.cnmobile.beibei.R; /** * @author 仿弹出popwindown菜单 */ public class AddDialogActivity extends Activity implements OnClickListener { private LinearLayout layout01, layout02, layout03; int sexStr; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dialog); initView(); } /** * 初始化组件 */ private void initView() { // 得到布局组件对象并设置监听事件 layout01 = (LinearLayout) findViewById(R.id.llayout01); layout02 = (LinearLayout) findViewById(R.id.llayout02); layout03 = (LinearLayout) findViewById(R.id.llayout03); layout01.setOnClickListener(this); layout02.setOnClickListener(this); layout03.setOnClickListener(this); } @Override public boolean onTouchEvent(MotionEvent event) { finish(); return true; } @Override public void onClick(View v) { switch (v.getId()) { case R.id.llayout01: Intent intent = new Intent(this, AddPetActivity.class); startActivity(intent); finish(); break; case R.id.llayout02: Intent intent1 = new Intent(this, AddTerminalActivity.class); startActivity(intent1); finish(); break; case R.id.llayout03: Intent intent2 = new Intent(this, MipcaActivityCapture.class); startActivity(intent2); finish(); break; default: break; } } }
最后在AndroidManifest文件里面声明
成都创新互联公司主营凉城网站建设的网络公司,主营网站建设方案,重庆APP开发,凉城h5小程序定制开发搭建,凉城网站营销推广欢迎凉城等地区企业咨询
本文名称:安卓仿微信右上角弹出菜单窗口
文章链接:http://azwzsj.com/article/ihoehp.html