学习Keyguard看到紧急呼叫 顺便看看学学。
从点加载布局开始:
Keyguard\EmergencCarrierArea.java
protected void onFinishInflate() {//加载布局
super.onFinishInflate();
mCarrierText = (CarrierText) findViewById(R.id.carrier_text);
mEmergencyButton = (EmergencyButton) findViewById(R.id.emergency_call_button);
// The emergency button overlaps the carrier text, only noticeable when highlighted.
// So temporarily hide the carrier text while the emergency button is pressed.
//紧急按钮重叠载文,只有当高亮。因此,当按下紧急按钮暂时隐藏载体的文字。
mEmergencyButton.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
if (mCarrierText.getVisibility() != View.VISIBLE) return false;
switch(event.getAction()) {
case MotionEvent.ACTION_DOWN:
mCarrierText.animate().alpha(0);//完全透明<