亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

消息對話框加載不出來。從第一開始的測試加載就加載不出,自動退出

不知道為什么。那么Dialog一加載到那個Button類下面,長按就自動退出。。。

package com.example.administrator.my_recorder.view;

import android.app.Dialog;
import android.content.Context;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.administrator.my_recorder.R;

/**
* Created by Administrator on 2015/12/27.
*/
public class DialogManager {
? ?private Dialog mDialog;
? ?private ImageView mIcon;
? ?private ImageView mVoice;
? ?private TextView mLable;
? ?private Context mContext;

? ?public DialogManager(Context context) {
? ? ?mContext=context;
? ?}

? ? ?public ?void showRecordingDialog(){
? ? ? ?mDialog=new Dialog(mContext, R.style.Theme_AudioDialog);
? ? ? ?LayoutInflater inflater=LayoutInflater.from(mContext);
? ? ? ?View view=inflater.inflate(R.layout.dialog_recorder,null);
? ? ? ?mDialog.setContentView(view);
? ? ? ?
? ? ? ?mIcon=(ImageView)mDialog.findViewById(R.id.id_recorder_dialog_icon);
? ? ? ?mVoice=(ImageView)mDialog.findViewById(R.id.id_recorder_dialog_voice);
? ? ? ?mLable=(TextView)mDialog.findViewById(R.id.id_recorde_dialog_label);
? ? ? ?
? ? ? ?mDialog.show();
? ?}
? ?public void ?recording(){
? ? ? ?//判斷mDialog不為空和正在顯示
? ? ? ?if(mDialog!=null && mDialog.isShowing()){
? ? ? ? ? ?mIcon.setVisibility(View.VISIBLE);
? ? ? ? ? ?mVoice.setVisibility(View.VISIBLE);
? ? ? ? ? ?mLable.setVisibility(View.VISIBLE);
? ? ? ? ? ?
? ? ? ? ? ?mIcon.setImageResource(R.mipmap.recorder);
? ? ? ? ? ?mLable.setText(R.string.str_recorder_recording);
? ? ? ? ?
? ? ? ?}
? ?}
? ?
? ?public ?void ?wangToCancell()
? ?{
? ? ? ?//判斷mDialog不為空和正在顯示
? ? ? ?if(mDialog!=null && mDialog.isShowing()){
? ? ? ? ? ?mIcon.setVisibility(View.VISIBLE); ?//顯示
? ? ? ? ? ?mVoice.setVisibility(View.GONE); ? ?//不顯示
? ? ? ? ? ?mLable.setVisibility(View.VISIBLE);

? ? ? ? ? ?mIcon.setImageResource(R.mipmap.cancel);
? ? ? ? ? ?mLable.setText(R.string.str_recorder_want_cancel);
? ? ? ?}
? ? ? ?
? ?}
? ?public void ?tooShort()
? ?{
? ? ? ?if(mDialog!=null && mDialog.isShowing()){
? ? ? ? ? ?mIcon.setVisibility(View.VISIBLE); ?//顯示
? ? ? ? ? ?mVoice.setVisibility(View.GONE); ? ?//不顯示
? ? ? ? ? ?mLable.setVisibility(View.VISIBLE);

? ? ? ? ? ?mIcon.setImageResource(R.mipmap.voice_to_short);
? ? ? ? ? ?mLable.setText("錄音時間果斷 取消");
? ? ? ?}
? ?}
? ?public void dimissDialog(){
? ? ? ?if(mDialog!=null && mDialog.isShowing()){
? ? ? ? ? ?mDialog.dismiss(); ?//隱藏
? ? ? ? ? ?mDialog=null;
? ? ? ?}
? ?}
? ?/*
? ?* 通過level 更新圖片**/
? ?public void ?updateVoiceLevel(int level) {
? ? ? ?if (mDialog != null && mDialog.isShowing()) {
? ? ? ? ? ?
? ? ? ? ? ?int resId=mContext.getResources().getIdentifier("v"+level,"mipmap",mContext.getPackageName());
? ? ? ? ? ?mVoice.setImageResource(resId);
? ? ? ?}
? ?}
}

正在回答

2 回答

你解決了嗎,我也是一樣的問題


0 回復 有任何疑惑可以回復我~

解決了沒

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
Android-仿微信語音聊天
  • 參與學習       43189    人
  • 解答問題       248    個

結合自定義View和API,Dialog管理等實現實現微信語音

進入課程

消息對話框加載不出來。從第一開始的測試加載就加載不出,自動退出

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號