因为电视屏幕比较大,而我们看电视时距离电视有一定距离,这样就需要动画效果比较明显,这个动画就是应用最广泛的,因为很酷,呵呵,你懂得,看了就知道。
效果如下图:
public class MainActivity extends Activity {
//下面这三个ImageView是阴影效果 ImageView mGlobalFloatView;
ImageView mGlobalShadowView;
ImageView mGlobalFocusView;
//下面这六个View是六个要选择的对象 View mSetAppView;
View mSetDisplayView;
View mSetEthView;
View mSetMoreView;
View mSetUpgradeView;
View mSetWifiView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mGlobalFloatView = (ImageView) findViewById(R.id.global_imageView_float);
mGlobalShadowView = (ImageView) findViewById(R.id.global_imageView_shadow);
mGlobalFocusView = (ImageView) findViewById(R.id.global_imageView_focus);
mSetAppView = findViewById(R.id.layout_app);
mSetDisplayView = findViewById(R.id.layout_display);
mSetEthView = findViewById(R.id.layout_eth);
mSetMoreView = findViewById(R.id.layout_more);
mSetUpgradeView = findViewById(R.id.layout_upgrade);
mSetWifiView = findViewById(R.id.layout_wifi);
OnFocusChangeListener focuseChangeListener = new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
//调用导入自己写的jar包的AnimationProvider类,如果想看代码可以反编译一下,哈哈
AnimationProvider.applyAnimation(MainActivity.this, hasFocus, v, mGlobalFocusView,
mGlobalFloatView, mGlobalShadowView);
}
};
mSetAppView.setOnFocusChangeListener(focuseChangeListener);
mSetDisplayView.setOnFocusChangeListener(focuseChangeListener);
mSetEthView.setOnFocusChangeListener(focuseChangeListener);
mSetMoreView.setOnFocusChangeListener(focuseChangeListener);
mSetUpgradeView.setOnFocusChangeListener(focuseChangeListener);
mSetWifiView.setOnFocusChangeListener(focuseChangeListener);
OnClickListener clickListener = new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = null;
switch (v.getId()) {
//下面分别跳转到系统设置的不同地方
case R.id.layout_app: intent = new Intent(Settings.ACTION_APPLICATION_SETTINGS);
break;
case R.id.layout_display:
intent = new Intent(Settings.ACTION_DISPLAY_SETTINGS);
break;
case R.id.layout_eth:
intent = new Intent("android.settings.ETHERNET_SETTINGS");
break;
case R.id.layout_more:
intent = new Intent(Settings.ACTION_SETTINGS);
break;
case R.id.layout_upgrade:
intent = new Intent("android.intent.action.ccdt.ota");
break;
case R.id.layout_wifi:
intent = new Intent(Settings.ACTION_WIFI_SETTINGS);
break;
default:
break;
}
try {
if (intent != null) {
startActivity(intent);
}
} catch (Exception e) {
e.printStackTrace();
}
}
};
mSetAppView.setOnClickListener(clickListener);
mSetDisplayView.setOnClickListener(clickListener);
mSetEthView.setOnClickListener(clickListener);
mSetMoreView.setOnClickListener(clickListener);
mSetUpgradeView.setOnClickListener(clickListener);
mSetWifiView.setOnClickListener(clickListener);
}
@Override
protected void onDestroy() {
AnimationProvider.reset();
super.onDestroy();
}
}