1 public class TVRemoteActivity extends Activity { 2 private static final String TAG = "TVRemoteActivity"; 3 @Override 4 protected void onCreate(Bundle savedInstanceState) { 5 // TODO Auto-generated method stub 6 super.onCreate(savedInstanceState); 7 setContentView(R.layout.tv_remote); 8 getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); 9 } 10 } 11
这么写就可以了:
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "TAG");
wakeLock.acquire();
不理解的地方我可以再补充