本文整理匯總了Java中android.app.TabActivity類的典型用法代碼示例。如果您正苦於以下問題:Java TabActivity類的具體用法?Java TabActivity怎麽用?Java TabActivity使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TabActivity類屬於android.app包,在下文中一共展示了TabActivity類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setTranslucentForImageView
import android.app.TabActivity; //導入依賴的package包/類
/**
* 為頭部是 ImageView 的界麵設置狀態欄透明
*
* @param activity 需要設置的activity
* @param statusBarAlpha 狀態欄透明度
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
activity.getWindow()
.getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
if (activity instanceof TabActivity){
activity.getWindow()//兼容TabActivity
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
} else {
activity.getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
addTranslucentView(activity, statusBarAlpha);
if (needOffsetView != null) {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
if (layoutParams != null) {
layoutParams.setMargins(0, getStatusBarHeight(activity), 0, 0);
}
}
}
示例2: detachTrackerFrameLayout
import android.app.TabActivity; //導入依賴的package包/類
private void detachTrackerFrameLayout(Activity activity) {
if (activity == null || activity instanceof TabActivity) {
return;
}
try {
ViewGroup container = (ViewGroup) activity.findViewById(android.R.id.content);
if (container == null) {
return;
}
if (container.getChildAt(0) instanceof TrackerFrameLayout) {
container.removeViewAt(0);
}
} catch (Exception e) {
TrackerLog.e(e.toString());
}
}
示例3: a
import android.app.TabActivity; //導入依賴的package包/類
public final void a(Context context) {
if (c(context, z[3])) {
a = true;
try {
if (Class.forName(context.getClass().getName()).newInstance() instanceof TabActivity) {
this.n = false;
}
} catch (Exception e) {
e.printStackTrace();
}
if (this.n) {
z.e(z[2], z[4]);
return;
}
this.n = true;
this.i = System.currentTimeMillis();
this.e = context.getClass().getName();
try {
this.d.execute(new h(this, context));
} catch (Exception e2) {
}
}
}
示例4: onActivityPaused
import android.app.TabActivity; //導入依賴的package包/類
public final void onActivityPaused(Activity activity) {
k.f = activity.getClass().getName();
if (ai.a(k.e)) {
k.e = activity.getClass().getName();
}
if (VERSION.SDK_INT >= 14 && k.a) {
if (!e.a && e.b().a()) {
k.d.put(k.e, Integer.valueOf(0));
if (!ai.a(k.g) && k.g.equals(k.e)) {
a.b(activity, k.c, k.e, 0);
}
}
if (activity instanceof TabActivity) {
z.d();
} else {
e.a = false;
}
}
}
示例5: setTranslucentForImageView
import android.app.TabActivity; //導入依賴的package包/類
/**
* 為頭部是 ImageView 的界麵設置狀態欄透明
*
* @param activity 需要設置的activity
* @param statusBarAlpha 狀態欄透明度
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
activity.getWindow()
.getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
if (activity instanceof TabActivity) {
activity.getWindow()//兼容TabActivity
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
} else {
activity.getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
addTranslucentView(activity, statusBarAlpha);
if (needOffsetView != null) {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
if (layoutParams != null) {
layoutParams.setMargins(0, getStatusBarHeight(activity), 0, 0);
}
}
}
示例6: onFling
import android.app.TabActivity; //導入依賴的package包/類
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CompareFunc.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(2);
else if (e2.getX() - e1.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(0);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
示例7: onFling
import android.app.TabActivity; //導入依賴的package包/類
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
if(targetPID != 0)
return false;
try {
if (Math.abs(e1.getY() - e2.getY()) > CompareFunc.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(0);
else if (e2.getX() - e1.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(3);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
示例8: onFling
import android.app.TabActivity; //導入依賴的package包/類
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CompareFunc.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(4);
else if (e2.getX() - e1.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(2);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
示例9: onFling
import android.app.TabActivity; //導入依賴的package包/類
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CommonUtil.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(2);
else if (e2.getX() - e1.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(0);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
示例10: onFling
import android.app.TabActivity; //導入依賴的package包/類
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
if(targetPID != 0)
return false;
try {
if (Math.abs(e1.getY() - e2.getY()) > CommonUtil.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(0);
else if (e2.getX() - e1.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(3);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
示例11: onFling
import android.app.TabActivity; //導入依賴的package包/類
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CommonUtil.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(3);
else if (e2.getX() - e1.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(1);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
示例12: onFling
import android.app.TabActivity; //導入依賴的package包/類
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CommonUtil.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(4);
else if (e2.getX() - e1.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(2);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
示例13: onFling
import android.app.TabActivity; //導入依賴的package包/類
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CommonUtil.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(1);
else if (e2.getX() - e1.getX() > CommonUtil.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CommonUtil.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(4);
else
return false;
} catch (Exception e) {
// nothing
}
GestureLong = false;
return true;
}
示例14: onFling
import android.app.TabActivity; //導入依賴的package包/類
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CompareFunc.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(3);
else if (e2.getX() - e1.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(1);
else
return false;
} catch (Exception e) {
// nothing
}
return true;
}
示例15: onFling
import android.app.TabActivity; //導入依賴的package包/類
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try {
if (Math.abs(e1.getY() - e2.getY()) > CompareFunc.SWIPE_MAX_OFF_PATH)
return false;
else if (e1.getX() - e2.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(1);
else if (e2.getX() - e1.getX() > CompareFunc.SWIPE_MIN_DISTANCE &&
Math.abs(velocityX) > CompareFunc.SWIPE_THRESHOLD_VELOCITY)
((TabActivity) this.getParent()).getTabHost().setCurrentTab(4);
else
return false;
} catch (Exception e) {
// nothing
}
GestureLong = false;
return true;
}