本文整理匯總了Java中android.view.ViewGroup.post方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewGroup.post方法的具體用法?Java ViewGroup.post怎麽用?Java ViewGroup.post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.ViewGroup
的用法示例。
在下文中一共展示了ViewGroup.post方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setStatusBar
import android.view.ViewGroup; //導入方法依賴的package包/類
/**
* 設置沉浸式狀態欄
*/
protected void setStatusBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
final ViewGroup linear_bar = (ViewGroup) findViewById(R.id.title_layout);
final int statusHeight = getStatusBarHeight();
linear_bar.post(new Runnable() {
@Override
public void run() {
// int titleHeight = linear_bar.getHeight();
Log.d("gaolei","titleHeight--------"+titleHeight);
Log.d("gaolei","statusHeight--------"+statusHeight);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) linear_bar.getLayoutParams();
params.height = statusHeight + titleHeight;
linear_bar.setLayoutParams(params);
}
});
}
}
示例2: setStatus
import android.view.ViewGroup; //導入方法依賴的package包/類
/**
* 係統版本4.4或以上才可以設置沉浸式狀態欄
*
* 設置狀態欄的高度
*/
protected void setStatus(){
bar_layout= (ViewGroup) findViewById(R.id.bar_layout);
if (Build.VERSION.SDK_INT >=Build.VERSION_CODES.KITKAT){
//設置狀態欄透明
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//設置導航欄透明
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
final int statusBarHeight = getStatusBarHeight();
bar_layout.post(new Runnable() {
@Override
public void run() {
//標題欄高度
int height=bar_layout.getHeight();
android.widget.RelativeLayout.LayoutParams params = (android.widget.RelativeLayout.LayoutParams) bar_layout.getLayoutParams();
//導航欄高度+通知欄高度
params.height=height+statusBarHeight;
bar_layout.setLayoutParams(params);
}
});
}
}
示例3: changeSettingButton
import android.view.ViewGroup; //導入方法依賴的package包/類
void changeSettingButton(final boolean isRev) {
final String overflowDesc = getString(R.string.accessibility_overflow);
final ViewGroup decor = (ViewGroup) getWindow().getDecorView();
decor.post(new Runnable() {
@Override
public void run() {
final ArrayList<View> outViews = new ArrayList<>();
decor.findViewsWithText(outViews, overflowDesc, View.FIND_VIEWS_WITH_CONTENT_DESCRIPTION);
if (outViews.isEmpty()) {
return;
}
ImageView overflow = (ImageView) outViews.get(0);
if (isRev) {
overflow.setImageResource(R.mipmap.ic_setting_rev);
} else {
overflow.setImageResource(R.mipmap.ic_setting);
}
}
});
}
示例4: onFinishInflate
import android.view.ViewGroup; //導入方法依賴的package包/類
@Override
protected void onFinishInflate() {
super.onFinishInflate();
if(getChildCount() > 0) {
if(getChildAt(0) instanceof ViewGroup) {
ViewGroup childLayout = (ViewGroup) getChildAt(0);
childLayout.post(new Runnable() {
@Override
public void run() {
updateCover();
}
});
if(childLayout.getChildCount() > 0) {
childLayout.getChildAt(0).post(new Runnable() {
@Override
public void run() {
updateCover();
}
});
}
}
}
updateCover();
}
示例5: showSticky
import android.view.ViewGroup; //導入方法依賴的package包/類
/**
* Pop stickyView to stack
*/
private void showSticky() {
WXCell headComponent = headComponentStack.pop();
headComponentStack.push(headComponent);
final View headerView = headComponent.getRealView();
if (headerView == null)
return;
headerViewStack.push(headerView);
headComponent.removeSticky();
final ViewGroup parent = (ViewGroup) getParent();
if(parent != null){
parent.post(WXThread.secure(new Runnable() {
@Override
public void run() {
ViewGroup existedParent;
if((existedParent = (ViewGroup)headerView.getParent())!= null){
existedParent.removeView(headerView);
}
parent.addView(headerView);
}
}));
}
}
示例6: removeSticky
import android.view.ViewGroup; //導入方法依賴的package包/類
/**
* remove top stickyView
* @param component
*/
private void removeSticky(WXComponent component) {
final WXCell headComponent = headComponentStack.pop();
if (!component.getRef().equals(headComponent.getRef())) {
headComponentStack.push(headComponent);
return;
}
final View headerView = headerViewStack.pop();
final ViewGroup parent = (ViewGroup) getParent();
if(parent != null){
parent.post(WXThread.secure(new Runnable() {
@Override
public void run() {
parent.removeView(headerView);
headComponent.recoverySticky();
}
}));
}
}
示例7: setStatusBarLayout
import android.view.ViewGroup; //導入方法依賴的package包/類
protected void setStatusBarLayout() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
final ViewGroup linear_bar = (ViewGroup) findViewById(R.id.title_layout);
final int statusHeight = getStatusBarHeight();
linear_bar.post(new Runnable() {
@Override
public void run() {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) linear_bar.getLayoutParams();
params.height = statusHeight ;
linear_bar.setLayoutParams(params);
}
});
}
}
示例8: initViewWithId
import android.view.ViewGroup; //導入方法依賴的package包/類
private void initViewWithId(Context context) {
mContext = context;
LayoutInflater inflater =
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.tag_root, this);
mRoot = (ViewGroup) findViewById(R.id.tag_root);
mTagImageView = (TagImageView) findViewById(R.id.tag_image_view);
setLayoutParamsToBeSetForRootLayout(mContext);
mRoot.post(mSetRootHeightWidth);
mRoot.setOnTouchListener(mTagOnTouchListener);
mGestureDetector = new GestureDetector(mRoot.getContext(), mTagGestureListener);
}
示例9: removeCling
import android.view.ViewGroup; //導入方法依賴的package包/類
private void removeCling(int id) {
setPagingEnabled(true);
clingActive = false;
final View cling = findViewById(id);
if(cling != null) {
final ViewGroup parent = (ViewGroup) cling.getParent();
parent.post(new Runnable() {
@Override
public void run() {
parent.removeView(cling);
}
});
}
}