找传奇、传世资源到传世资源站!

Android之系统音量亮度调节

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

主界面的布局主要是三个按钮,点击按钮即可进行音量和亮度的进度条调节框
from clipboard from clipboard
package com.example.contentprovidertest;import android.app.Activity;import android.content.ContentResolver;import android.content.ContentValues;import android.content.Context;import android.content.Intent;import android.database.Cursor;import android.graphics.drawable.BitmapDrawable;import android.media.AudioManager;import android.net.Uri;import android.os.Bundle;import android.util.Log;import android.view.Gravity;import android.view.LayoutInflater;import android.view.View;import android.view.View.OnClickListener;import android.view.WindowManager;import android.widget.Button;import android.widget.ImageView;import android.widget.PopupWindow;import android.widget.SeekBar;import android.widget.SeekBar.OnSeekBarChangeListener;public class MainActivity extends Activity implements OnClickListener{ private static final String TAG = "MainActivity"; private ImageView home; private ImageView volume; private ImageView brightness; private VolumePopwindow volumePopwindow; private BrightnessPopwindow brightnessPopwindow; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); initListener(); }private void initView() {// TODO Auto-generated method stubhome=(ImageView) findViewById(R.id.home);volume=(ImageView) findViewById(R.id.volume);brightness=(ImageView) findViewById(R.id.brightness);}private void initListener() {// TODO Auto-generated method stubhome.setOnClickListener(this);volume.setOnClickListener(this);brightness.setOnClickListener(this);}@Overridepublic void onClick(View view) {// TODO Auto-generated method stubswitch (view.getId()) {case R.id.home:Intent intent = new Intent(Intent.ACTION_MAIN);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addCategory(Intent.CATEGORY_HOME); startActivity(intent);Log.i(TAG, "home is click");break; case R.id.volume: volumePopwindow = new VolumePopwindow(MainActivity.this); //volumePopwindow.showAtLocation(view,Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0); volumePopwindow.showAtLocation(view, Gravity.CENTER_HORIZONTAL, 0, 0); Log.i(TAG, "volume is click"); break; case R.id.brightness: brightnessPopwindow = new BrightnessPopwindow(MainActivity.this); //volumePopwindow.showAtLocation(view,Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0); brightnessPopwindow.showAtLocation(view, Gravity.CENTER_HORIZONTAL, 0, 0); Log.i(TAG, "brightness is click"); break;default:break;}} }

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复