當前位置: 首頁>>代碼示例>>Java>>正文


Java TabActivity類代碼示例

本文整理匯總了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);
        }
    }
}
 
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:33,代碼來源:StatusBarUtil.java

示例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());
    }

}
 
開發者ID:alibaba,項目名稱:android_viewtracker,代碼行數:21,代碼來源:TrackerManager.java

示例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) {
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:24,代碼來源:e.java

示例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;
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:20,代碼來源:l.java

示例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);
        }
    }
}
 
開發者ID:huxizhijian,項目名稱:HHComicViewer,代碼行數:33,代碼來源:StatusBarUtil.java

示例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;
}
 
開發者ID:PowerLab,項目名稱:PowerDoctor,代碼行數:21,代碼來源:InterfaceList.java

示例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;
}
 
開發者ID:PowerLab,項目名稱:PowerDoctor,代碼行數:24,代碼來源:DebugBox.java

示例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;
}
 
開發者ID:PowerLab,項目名稱:PowerDoctor,代碼行數:21,代碼來源:MiscBox.java

示例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;
}
 
開發者ID:eolwral,項目名稱:OSMonitor.Legacy,代碼行數:21,代碼來源:InterfaceList.java

示例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;
}
 
開發者ID:eolwral,項目名稱:OSMonitor.Legacy,代碼行數:24,代碼來源:DebugBox.java

示例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;
}
 
開發者ID:eolwral,項目名稱:OSMonitor.Legacy,代碼行數:21,代碼來源:NetworkList.java

示例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;
}
 
開發者ID:eolwral,項目名稱:OSMonitor.Legacy,代碼行數:21,代碼來源:MiscBox.java

示例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;
}
 
開發者ID:eolwral,項目名稱:OSMonitor.Legacy,代碼行數:23,代碼來源:ProcessList.java

示例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;
}
 
開發者ID:eolwral,項目名稱:OSMonitor.Classical,代碼行數:21,代碼來源:NetworkList.java

示例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;
}
 
開發者ID:eolwral,項目名稱:OSMonitor.Classical,代碼行數:23,代碼來源:ProcessList.java


注:本文中的android.app.TabActivity類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。