Android实现底部缓慢弹出菜单

时间:2021-05-20

项目要求要做一个从底部缓慢弹出一个Button Menu

开始编码:
MyselfFragment

package io.dcloud.H5B79C397.fragment;import android.content.Context;import android.content.Intent;import android.net.Uri;import android.os.Bundle;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.Button;import android.widget.RelativeLayout;import android.widget.Toast;import com.android.volley.VolleyError;import com.vanda.vandalibnetwork.fragment.BaseFragment;import java.util.Map;import cn.sharesdk.framework.ShareSDK;import cn.sharesdk.onekeyshare.OnekeyShare;import cn.sharesdk.sina.weibo.SinaWeibo;import cn.sharesdk.tencent.qq.QQ;import cn.sharesdk.wechat.friends.Wechat;import cn.sharesdk.wechat.moments.WechatMoments;import io.dcloud.H5B79C397.R;import io.dcloud.H5B79C397.Urls;import io.dcloud.H5B79C397.activity.BottomMenu;import io.dcloud.H5B79C397.activity.LoginActivity;import io.dcloud.H5B79C397.activity.Myself_About_fae;import io.dcloud.H5B79C397.activity.Myself_Invitation;import io.dcloud.H5B79C397.activity.Myself_help;import io.dcloud.H5B79C397.activity.Myself_setting;import io.dcloud.H5B79C397.activity.RegisterActivity;import io.dcloud.H5B79C397.activity.user_management;import io.dcloud.H5B79C397.pojo.InformmationData;import io.dcloud.H5B79C397.util.ActionBarUtil;import io.dcloud.H5B79C397.util.ExtUtils;/** * 用户个人信息界面 */public class MyselfFragment extends BaseFragment<InformmationData> implements View.OnClickListener { private Context mContext; private View view; private BottomMenu menuWindow; private RelativeLayout layout_advise, layout_collect, layout_logo, layout_share, layout_qr_code, layout_help, layout_set, layout_url; private Button btnLogin, btnRegister; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment_information, container, false); initView(); return view; } @Override public void onStart() { super.onStart(); } private void initView() { new ActionBarUtil(view, R.id.actionBar, R.id.Back, R.id.Title, R.id.Activity, "我的管理中心", getActivity(), 2); layout_advise = (RelativeLayout) view.findViewById(R.id.myself_advise); layout_collect = (RelativeLayout) view.findViewById(R.id.myself_collect); layout_logo = (RelativeLayout) view.findViewById(R.id.myself_logo); layout_share = (RelativeLayout) view.findViewById(R.id.myself_share); layout_qr_code = (RelativeLayout) view.findViewById(R.id.myself_qr_code); layout_help = (RelativeLayout) view.findViewById(R.id.myself_help); layout_set = (RelativeLayout) view.findViewById(R.id.myself_set); layout_url = (RelativeLayout) view.findViewById(R.id.myself_url); btnLogin = (Button) view.findViewById(R.id.myself_login); btnRegister = (Button) view.findViewById(R.id.myself_register); layout_advise.setOnClickListener(this); layout_collect.setOnClickListener(this); layout_logo.setOnClickListener(this); layout_share.setOnClickListener(this); layout_qr_code.setOnClickListener(this); layout_help.setOnClickListener(this); layout_set.setOnClickListener(this); layout_url.setOnClickListener(this); btnLogin.setOnClickListener(this); btnRegister.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.myself_advise: startActivity(new Intent(getActivity(), user_management.class)); break; case R.id.myself_collect: break; case R.id.myself_logo: Intent intent=new Intent(getActivity(),Myself_About_fae.class); startActivity(intent); break; case R.id.myself_share: menuWindow = new BottomMenu(mContext, clickListener); menuWindow.show(); break; case R.id.myself_qr_code: startActivity(new Intent(getActivity(), Myself_Invitation.class)); break; case R.id.myself_help: startActivity(new Intent(getActivity(), Myself_help.class)); break; case R.id.myself_set: startActivity(new Intent(getActivity(), Myself_setting.class)); break; case R.id.myself_url: Uri uri = Uri.parse("http:///apk/res/android"> <translate android:duration="300" android:fromXDelta="0" android:toXDelta="0" android:fromYDelta="1920" android:toYDelta="0" /> <alpha android:duration="300" android:fromAlpha="0" android:toAlpha="1" /></set>

最后上图:

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章