Java 类android.view.ViewGroup.LayoutParams 实例源码
项目:aos-Video
文件:NewVideosActionProvider.java
public DropDownWindow(View anchor, View contentView) {
super(anchor.getContext());
mAnchor = anchor;
final Resources r = anchor.getResources();
setBackgroundDrawable(r.getDrawable(R.drawable.dialog_full_holo_dark));
setWidth(r.getDimensionPixelSize(R.dimen.new_videos_action_dropdown_width)); // Takes too much space on tablets when using LayoutParams.WRAP_CONTENT
setHeight(LayoutParams.WRAP_CONTENT);
setContentView(contentView);
setTouchable(true);
setFocusable(true);
// listen to anchor getting removed (e.g. activity destroyed)
// -> dismiss() self so we don't keep this window open
anchor.addOnAttachStateChangeListener(this);
}
项目:AOSP-Kayboard-7.1.2
文件:LatinIME.java
private void showOptionDialog(final AlertDialog dialog) {
final IBinder windowToken = mKeyboardSwitcher.getMainKeyboardView().getWindowToken();
if (windowToken == null) {
return;
}
final Window window = dialog.getWindow();
final WindowManager.LayoutParams lp = window.getAttributes();
lp.token = windowToken;
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
window.setAttributes(lp);
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
mOptionsDialog = dialog;
dialog.show();
}
项目:Mobike
文件:EditPage.java
public void setActivity(Activity activity) {
super.setActivity(activity);
if (isDialogMode()) {
System.err.println("Theme classic does not support dialog mode!");
// activity.setTheme(android.R.style.Theme_Dialog);
// activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
// if (Build.VERSION.SDK_INT >= 11) {
// try {
// ReflectHelper.invokeInstanceMethod(activity, "setFinishOnTouchOutside", false);
// } catch (Throwable e) {}
// }
}
activity.getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE |
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
}
项目:YiZhi
文件:EditPage.java
@Override
protected int onSetTheme(int resid, boolean atLaunch) {
if (isDialogMode()) {
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
if (Build.VERSION.SDK_INT >= 11) {
try {
ReflectHelper.invokeInstanceMethod(activity, "setFinishOnTouchOutside", false);
} catch (Throwable e) {}
}
return android.R.style.Theme_Dialog;
} else {
activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE
| WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
}
return super.onSetTheme(resid, atLaunch);
}
项目:boohee_v5.6
文件:PullToRefreshView.java
public void setAdapter(PullToRefreshAdatper pullToRefreshAdatper) {
this.adapter = pullToRefreshAdatper;
removeAllViews();
this.bodyView = (View) pullToRefreshAdatper.getBodyView();
LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
layoutParams.addRule(9, -1);
layoutParams.addRule(11, -1);
layoutParams.addRule(10, -1);
addView(this.bodyView, layoutParams);
this.headerView = pullToRefreshAdatper.getHeaderView();
this.headerView.measure(0, 0);
this.headerHeight = this.headerView.getMeasuredHeight();
layoutParams = new RelativeLayout.LayoutParams(-2, this.headerHeight);
layoutParams.addRule(9, -1);
layoutParams.addRule(11, -1);
layoutParams.addRule(10, -1);
layoutParams.topMargin = -this.headerHeight;
addView(this.headerView, layoutParams);
}
项目:letv
文件:MyDownloadActivity.java
private void doTabPageIndicatorAnimator(int start, int end) {
this.mTabPIValueAnimator = ValueAnimator.ofInt(new int[]{start, end});
this.mTabPIValueAnimator.addUpdateListener(new AnimatorUpdateListener(this) {
final /* synthetic */ MyDownloadActivity this$0;
{
if (HotFix.PREVENT_VERIFY) {
System.out.println(VerifyLoad.class);
}
this.this$0 = this$0;
}
public void onAnimationUpdate(ValueAnimator animation) {
int value = ((Integer) animation.getAnimatedValue()).intValue();
LayoutParams layoutParams = this.this$0.mIndicator.getLayoutParams();
layoutParams.height = value;
this.this$0.mIndicator.setLayoutParams(layoutParams);
}
});
this.mTabPIValueAnimator.start();
}
项目:weex-uikit
文件:WXViewUtils.java
public static boolean onScreenArea(View view) {
if (view == null || view.getVisibility() != View.VISIBLE) {
return false;
}
int[] p = new int[2];
view.getLocationOnScreen(p);
LayoutParams lp = view.getLayoutParams();
int viewH = 0;
if (lp != null) {
viewH = lp.height;
} else {
viewH = view.getHeight();
}
return (p[1] > 0 && (p[1] - WXViewUtils.getScreenHeight(WXEnvironment.sApplication) < 0))
|| (viewH + p[1] > 0 && p[1] <= 0);
}
项目:CXJPadProject
文件:ThankDialog.java
@SuppressWarnings("deprecation")
public ThankDialog create() {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final ThankDialog dialog = new ThankDialog(context, ResourceUtils.getIdByName(context, "style", "sobot_Dialog"));
dialog.setCanceledOnTouchOutside(false);
View layout = inflater.inflate(ResourceUtils.getIdByName(context, "layout", "sobot_thank_dialog_layout"), null);
dialog.addContentView(layout, new LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
if (message != null) {
((TextView) layout.findViewById(ResourceUtils.getIdByName(context, "id", "sobot_message"))).setText(message);
}
dialog.setContentView(layout);
return dialog;
}
项目:ProgressManager
文件:a.java
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
event.setClassName(getClass().getName());
event.setPackageName(getPackageName());
LayoutParams params = getWindow().getAttributes();
boolean isFullScreen = (params.width == LayoutParams.MATCH_PARENT) &&
(params.height == LayoutParams.MATCH_PARENT);
event.setFullScreen(isFullScreen);
CharSequence title = getTitle();
if (!TextUtils.isEmpty(title)) {
event.getText().add(title);
}
return true;
}
项目:Leanplum-Android-SDK
文件:BaseMessageDialog.java
private RelativeLayout createTitleView(Context context) {
RelativeLayout view = new RelativeLayout(context);
view.setLayoutParams(new LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
TextView title = new TextView(context);
title.setPadding(0, SizeUtil.dp5, 0, SizeUtil.dp5);
title.setGravity(Gravity.CENTER);
title.setText(options.getTitle());
title.setTextColor(options.getTitleColor());
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, SizeUtil.textSize0);
title.setTypeface(null, Typeface.BOLD);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
title.setLayoutParams(layoutParams);
view.addView(title, title.getLayoutParams());
return view;
}
项目:letv
文件:PullToRefreshBase.java
protected void updateUIForMode() {
LinearLayout.LayoutParams lp = getLoadingLayoutLayoutParams();
if (this == this.mHeaderLayout.getParent()) {
removeView(this.mHeaderLayout);
}
if (this.mMode.showHeaderLoadingLayout()) {
addViewInternal(this.mHeaderLayout, 0, lp);
}
if (this == this.mFooterLayout.getParent()) {
removeView(this.mFooterLayout);
}
if (this.mMode.showFooterLoadingLayout()) {
addViewInternal(this.mFooterLayout, lp);
}
refreshLoadingViewsSize();
this.mCurrentMode = this.mMode != Mode.BOTH ? this.mMode : Mode.PULL_FROM_START;
}
项目:SLTableView
文件:OptionsPopupWindow.java
public OptionsPopupWindow(Context context) {
super(context);
this.setWidth(LayoutParams.FILL_PARENT);
this.setHeight(LayoutParams.WRAP_CONTENT);
this.setBackgroundDrawable(new BitmapDrawable());// 这样设置才能点击屏幕外dismiss窗口
this.setOutsideTouchable(true);
this.setAnimationStyle(R.style.timepopwindow_anim_style);
LayoutInflater mLayoutInflater = LayoutInflater.from(context);
rootView = mLayoutInflater.inflate(R.layout.pw_options, null);
// -----确定和取消按钮
btnSubmit = rootView.findViewById(R.id.btnSubmit);
btnSubmit.setTag(TAG_SUBMIT);
btnCancel = rootView.findViewById(R.id.btnCancel);
btnCancel.setTag(TAG_CANCEL);
btnSubmit.setOnClickListener(this);
btnCancel.setOnClickListener(this);
// ----转轮
final View optionspicker = rootView.findViewById(R.id.optionspicker);
ScreenInfo screenInfo = new ScreenInfo((Activity) context);
wheelOptions = new WheelOptions(optionspicker);
wheelOptions.screenheight = screenInfo.getHeight();
setContentView(rootView);
}
项目:cordova-plugin-x5-webview
文件:X5WebChromeClient.java
/**
* Ask the host application for a custom progress view to show while
* a <video> is loading.
* @return View The progress view.
*/
public View getVideoLoadingProgressView() {
if (mVideoProgressView == null) {
// Create a new Loading view programmatically.
// create the linear layout
LinearLayout layout = new LinearLayout(parentEngine.getView().getContext());
layout.setOrientation(LinearLayout.VERTICAL);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
layout.setLayoutParams(layoutParams);
// the proress bar
ProgressBar bar = new ProgressBar(parentEngine.getView().getContext());
LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
barLayoutParams.gravity = Gravity.CENTER;
bar.setLayoutParams(barLayoutParams);
layout.addView(bar);
mVideoProgressView = layout;
}
return mVideoProgressView;
}
项目:weex-3d-map
文件:WXRenderStatement.java
WXComponent createBodyOnDomThread(WXDomObject dom) {
if (mWXSDKInstance == null) {
return null;
}
WXDomObject domObject = new WXDomObject();
WXDomObject.prepareGod(domObject);
mGodComponent = (WXVContainer) WXComponentFactory.newInstance(mWXSDKInstance, domObject, null);
mGodComponent.createView(null, -1);
if (mGodComponent == null) {
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e("rootView failed!");
}
//TODO error callback
return null;
}
FrameLayout frameLayout = (FrameLayout) mGodComponent.getHostView();
ViewGroup.LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
frameLayout.setLayoutParams(layoutParams);
frameLayout.setBackgroundColor(Color.TRANSPARENT);
WXComponent component = generateComponentTree(dom, mGodComponent);
mGodComponent.addChild(component);
mRegistry.put(component.getRef(), component);
return component;
}
项目:boohee_v5.6
文件:AsyncImageView.java
private int[] getSize() {
int width = getWidth();
int height = getHeight();
if (width == 0 || height == 0) {
LayoutParams layoutParams = getLayoutParams();
if (layoutParams != null) {
width = layoutParams.width;
height = layoutParams.height;
}
}
if (width == 0 || r0 == 0) {
measure(0, 0);
width = getMeasuredWidth();
height = getMeasuredHeight();
}
return new int[]{width, height};
}
项目:Ec2m
文件:UiSizeUtil.java
/**
*
* @param view
* @param width (-1 MatchParent,-2 WrapContent,other)
* @param height(-1 MatchParent,-2 WrapContent,other)
*/
public static void LayoutChange(View view,int width,int height){
// 1、获取控件所在的布局
LayoutParams para = view.getLayoutParams();//获取按钮的布局
// 2、修改布局中的height,width属性
if (width==MATCH_PARENT){
para.width=LayoutParams.MATCH_PARENT;
}else if(width==WRAP_CONTENT) {
para.width=LayoutParams.WRAP_CONTENT;//修改宽度
}else if(width ==NO_CHANGE){
}else {
para.width = width;
}
if (height==MATCH_PARENT){
para.height=LayoutParams.MATCH_PARENT;
}else if(height==WRAP_CONTENT) {
para.height=LayoutParams.WRAP_CONTENT;//修改宽度
}else if(height ==NO_CHANGE){
}else {
para.height=height;//修改高度
}
// 3、重新设置修改后的布局给控件
view.setLayoutParams(para); //设置修改后的布局。
}
项目:LoRaWAN-Smart-Parking
文件:CordovaChromeClient.java
@Override
/**
* Ask the host application for a custom progress view to show while
* a <video> is loading.
* @return View The progress view.
*/
public View getVideoLoadingProgressView() {
if (mVideoProgressView == null) {
// Create a new Loading view programmatically.
// create the linear layout
LinearLayout layout = new LinearLayout(this.appView.getContext());
layout.setOrientation(LinearLayout.VERTICAL);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
layout.setLayoutParams(layoutParams);
// the proress bar
ProgressBar bar = new ProgressBar(this.appView.getContext());
LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
barLayoutParams.gravity = Gravity.CENTER;
bar.setLayoutParams(barLayoutParams);
layout.addView(bar);
mVideoProgressView = layout;
}
return mVideoProgressView;
}
项目:LiuAGeAndroid
文件:EditPage.java
/** 动态适配编辑界面的高度 */
public void run() {
int height = svContent.getChildAt(0).getHeight();
RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams());
if (height > maxBodyHeight && lp.height != maxBodyHeight) {
lp.height = maxBodyHeight;
svContent.setLayoutParams(lp);
} else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
lp.height = LayoutParams.WRAP_CONTENT;
svContent.setLayoutParams(lp);
}
}
项目:ucar-weex-core
文件:LayoutParamsProperty.java
@Override
public Integer get(View object) {
LayoutParams layoutParams;
if (object != null && (layoutParams = object.getLayoutParams()) != null) {
return getProperty(layoutParams);
}
return 0;
}
项目:CSipSimple
文件:ActionBarSherlockNative.java
@Override
public void setContentView(View view, LayoutParams params) {
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setContentView] view: " + view + ", params: " + params);
mActivity.getWindow().setContentView(view, params);
initActionBar();
}
项目:cordova.plugins.X5WebView
文件:X5WebChromeClient.java
@Override
/**
* Ask the host application for a custom progress view to show while
* a <video> is loading.
* @return View The progress view.
*/
public View getVideoLoadingProgressView() {
if (mVideoProgressView == null) {
// Create a newx Loading view programmatically.
// create the linear layout
LinearLayout layout = new LinearLayout(parentEngine.getView().getContext());
layout.setOrientation(LinearLayout.VERTICAL);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
layout.setLayoutParams(layoutParams);
// the proress bar
ProgressBar bar = new ProgressBar(parentEngine.getView().getContext());
LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
barLayoutParams.gravity = Gravity.CENTER;
bar.setLayoutParams(barLayoutParams);
layout.addView(bar);
mVideoProgressView = layout;
}
return mVideoProgressView;
}
项目:browser
文件:BrowserActivity.java
/**
* turns on fullscreen mode in the app
*
* @param enabled
* whether to enable fullscreen or not
*/
public void setFullscreen(boolean enabled) {
Window win = getWindow();
WindowManager.LayoutParams winParams = win.getAttributes();
final int bits = WindowManager.LayoutParams.FLAG_FULLSCREEN;
if (enabled) {
winParams.flags |= bits;
} else {
winParams.flags &= ~bits;
if (mCustomView != null) {
mCustomView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
} else {
mBrowserFrame.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
}
win.setAttributes(winParams);
if(mToolbarLayout!=null){
mToolbarLayout.setVisibility(View.GONE);
}
if(shortcutToolbar!=null){
shortcutToolbar.setVisibility(View.GONE);
}
if(fullscreenCancelBtn!=null){
fullscreenCancelBtn.setVisibility(View.VISIBLE);
}
}
项目:letv
文件:AuthActivity.java
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
try {
Bundle extras = getIntent().getExtras();
if (extras == null) {
finish();
return;
}
try {
this.d = extras.getString(b);
String string = extras.getString("params");
if (k.a(string)) {
Method method;
super.requestWindowFeature(1);
this.f = new Handler(getMainLooper());
View linearLayout = new LinearLayout(getApplicationContext());
LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
linearLayout.setOrientation(1);
setContentView(linearLayout, layoutParams);
this.c = new WebView(getApplicationContext());
layoutParams.weight = 1.0f;
this.c.setVisibility(0);
linearLayout.addView(this.c, layoutParams);
WebSettings settings = this.c.getSettings();
settings.setUserAgentString(settings.getUserAgentString() + k.c(getApplicationContext()));
settings.setRenderPriority(RenderPriority.HIGH);
settings.setSupportMultipleWindows(true);
settings.setJavaScriptEnabled(true);
settings.setSavePassword(false);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setMinimumFontSize(settings.getMinimumFontSize() + 8);
settings.setAllowFileAccess(false);
settings.setTextSize(TextSize.NORMAL);
this.c.setVerticalScrollbarOverlay(true);
this.c.setWebViewClient(new b());
this.c.setWebChromeClient(new a());
this.c.setDownloadListener(new a(this));
this.c.loadUrl(string);
if (VERSION.SDK_INT >= 7) {
try {
method = this.c.getSettings().getClass().getMethod("setDomStorageEnabled", new Class[]{Boolean.TYPE});
if (method != null) {
method.invoke(this.c.getSettings(), new Object[]{Boolean.valueOf(true)});
}
} catch (Exception e) {
}
}
try {
method = this.c.getClass().getMethod("removeJavascriptInterface", new Class[0]);
if (method != null) {
method.invoke(this.c, new Object[]{"searchBoxJavaBridge_"});
return;
}
return;
} catch (Exception e2) {
return;
}
}
finish();
} catch (Exception e3) {
finish();
}
} catch (Exception e4) {
finish();
}
}
项目:treasure
文件:PhotoViewActivity.java
@Override
public View instantiateItem(ViewGroup container, int position) {
PhotoView photoView = new PhotoView(container.getContext());
Glide.with(getApplicationContext())
.load(mImageUrlList.get(position))
.into(photoView);
// Now just add PhotoView to ViewPager and return it
container.addView(photoView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
return photoView;
}
项目:topnews
文件:EditPage.java
/** 动态适配编辑界面的高度 */
public void run() {
int height = svContent.getChildAt(0).getHeight();
RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams());
if (height > maxBodyHeight && lp.height != maxBodyHeight) {
lp.height = maxBodyHeight;
svContent.setLayoutParams(lp);
} else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
lp.height = LayoutParams.WRAP_CONTENT;
svContent.setLayoutParams(lp);
}
}
项目:letv
文件:AuthDialog.java
private void c() {
d();
LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
this.k = new c(this.l);
this.k.setLayoutParams(layoutParams);
this.f = new FrameLayout(this.l);
layoutParams.gravity = 17;
this.f.setLayoutParams(layoutParams);
this.f.addView(this.k);
this.f.addView(this.h);
setContentView(this.f);
}
项目:easyfilemanager
文件:DocumentsActivity.java
private void initProtection() {
if(mAuthenticated || !SettingsActivity.isPinEnabled(this)){
return;
}
final Dialog d = new Dialog(this, R.style.Theme_Document_DailogPIN);
d.setContentView(new PinViewHelper((LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE), null, null) {
public void onEnter(String password) {
super.onEnter(password);
if (SettingsActivity.checkPin(DocumentsActivity.this, password)) {
mAuthenticated = true;
d.dismiss();
}
else {
showError(R.string.incorrect_pin);
}
}
public void onCancel() {
super.onCancel();
finish();
d.dismiss();
}
}.getView(), new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
PINDialogFragment pinFragment = new PINDialogFragment();
pinFragment.setDialog(d);
pinFragment.setCancelable(false);
pinFragment.show(getFragmentManager(), "PIN Dialog");
}
项目:19porn
文件:PlayerActivity.java
private void doBrightnessTouch(float y_changed) {
if (mTouchAction != TOUCH_NONE && mTouchAction != TOUCH_BRIGHTNESS)
return;
if (mIsFirstBrightnessGesture) initBrightnessTouch();
mTouchAction = TOUCH_BRIGHTNESS;
float delta = - y_changed / mSurfaceYDisplayRange * 0.07f;
WindowManager.LayoutParams lp = getWindow().getAttributes();
float bright = Math.min(Math.max(lp.screenBrightness + delta, 0.01f), 1);
lp.screenBrightness = bright;
getWindow().setAttributes(lp);
showBrightnessTipInfoTimeout((int)(bright * 100) + "%", 1000);
}
项目:boohee_v5.6
文件:BottomSheetBehavior.java
public static <V extends View> BottomSheetBehavior<V> from(V view) {
LayoutParams params = view.getLayoutParams();
if (params instanceof CoordinatorLayout.LayoutParams) {
Behavior behavior = ((CoordinatorLayout.LayoutParams) params).getBehavior();
if (behavior instanceof BottomSheetBehavior) {
return (BottomSheetBehavior) behavior;
}
throw new IllegalArgumentException("The view is not associated with BottomSheetBehavior");
}
throw new IllegalArgumentException("The view is not a child of CoordinatorLayout");
}
项目:Mybilibili
文件:EditPage.java
/** 动态适配编辑界面的高度 */
public void run() {
int height = svContent.getChildAt(0).getHeight();
RelativeLayout.LayoutParams lp = ResHelper.forceCast(svContent.getLayoutParams());
if (height > maxBodyHeight && lp.height != maxBodyHeight) {
lp.height = maxBodyHeight;
svContent.setLayoutParams(lp);
} else if (height < maxBodyHeight && lp.height == maxBodyHeight) {
lp.height = LayoutParams.WRAP_CONTENT;
svContent.setLayoutParams(lp);
}
}
项目:FireFiles
文件:AppRate.java
private void displayViews(ViewGroup mainView) {
if(null != viewGroup){
viewGroup.setVisibility(View.VISIBLE);
viewGroup.addView(mainView);
}
else{
LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
activity.addContentView(mainView, params);
}
Animation fadeInAnimation = AnimationUtils.loadAnimation(activity, android.R.anim.fade_in);
mainView.startAnimation(fadeInAnimation);
if (onShowListener != null) onShowListener.onRateAppShowing();
}
项目:topnews
文件:EditPageLand.java
private void initBottom(LinearLayout llBottom, float ratio) {
LinearLayout llAt = new LinearLayout(activity);
llAt.setPadding(0, 0, 0, 5);
llAt.setBackgroundColor(0xffffffff);
int bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, bottomHeight);
llBottom.addView(llAt, lp);
tvAt = new TextView(activity);
tvAt.setTextColor(0xff3b3b3b);
tvAt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
tvAt.setGravity(Gravity.BOTTOM);
tvAt.setText("@");
int padding = (int) (DESIGN_LEFT_PADDING * ratio);
tvAt.setPadding(padding, 0, padding, 0);
lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
llAt.addView(tvAt, lp);
tvAt.setOnClickListener(this);
if (isShowAtUserLayout(platform.getName())) {
tvAt.setVisibility(View.VISIBLE);
} else {
tvAt.setVisibility(View.INVISIBLE);
}
tvTextCouter = new TextView(activity);
tvTextCouter.setTextColor(0xff3b3b3b);
tvTextCouter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
tvTextCouter.setGravity(Gravity.BOTTOM | Gravity.RIGHT);
onTextChanged(etContent.getText(), 0, 0, 0);
tvTextCouter.setPadding(padding, 0, padding, 0);
lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
lp.weight = 1;
llAt.addView(tvTextCouter, lp);
View v = new View(activity);
v.setBackgroundColor(0xffcccccc);
int px1 = ratio > 1 ? ((int) ratio) : 1;
lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px1);
llBottom.addView(v, lp);
}
项目:ProgressManager
文件:a.java
final void attach(Context context, ActivityThread aThread,
Instrumentation instr, IBinder token, int ident,
Application application, Intent intent, ActivityInfo info,
CharSequence title, Activity parent, String id,
NonConfigurationInstances lastNonConfigurationInstances,
Configuration config, String referrer, IVoiceInteractor voiceInteractor,
Window window) {
attachBaseContext(context);
mFragments.attachHost(null /*parent*/);
mWindow = new PhoneWindow(this, window);
mWindow.setWindowControllerCallback(this);
mWindow.setCallback(this);
mWindow.setOnWindowDismissedCallback(this);
mWindow.getLayoutInflater().setPrivateFactory(this);
if (info.softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) {
mWindow.setSoftInputMode(info.softInputMode);
}
if (info.uiOptions != 0) {
mWindow.setUiOptions(info.uiOptions);
}
mUiThread = Thread.currentThread();
mMainThread = aThread;
mInstrumentation = instr;
mToken = token;
mIdent = ident;
mApplication = application;
mIntent = intent;
mReferrer = referrer;
mComponent = intent.getComponent();
mActivityInfo = info;
mTitle = title;
mParent = parent;
mEmbeddedID = id;
mLastNonConfigurationInstances = lastNonConfigurationInstances;
if (voiceInteractor != null) {
if (lastNonConfigurationInstances != null) {
mVoiceInteractor = lastNonConfigurationInstances.voiceInteractor;
} else {
mVoiceInteractor = new VoiceInteractor(voiceInteractor, this, this,
Looper.myLooper());
}
}
mWindow.setWindowManager(
(WindowManager)context.getSystemService(Context.WINDOW_SERVICE),
mToken, mComponent.flattenToString(),
(info.flags & ActivityInfo.FLAG_HARDWARE_ACCELERATED) != 0);
if (mParent != null) {
mWindow.setContainer(mParent.getWindow());
}
mWindowManager = mWindow.getWindowManager();
mCurrentConfig = config;
}
项目:OSchina_resources_android
文件:CommonDialog.java
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (TDevice.isTablet()) {
int maxWidth = (int) TDevice.dp2px(360f);
if (maxWidth < TDevice.getScreenWidth()) {
WindowManager.LayoutParams params = getWindow().getAttributes();
params.width = maxWidth;
getWindow().setAttributes(params);
}
}
}
项目:MyFire
文件:EditPagePort.java
public void onCreate() {
super.onCreate();
int screenHeight = R.getScreenHeight(activity);
float ratio = ((float) screenHeight) / DESIGN_SCREEN_HEIGHT;
maxBodyHeight = 0;
llPage = new LinearLayout(activity);
llPage.setOrientation(LinearLayout.VERTICAL);
activity.setContentView(llPage);
rlTitle = new RelativeLayout(activity);
rlTitle.setBackgroundColor(0xffe6e9ec);
int titleHeight = (int) (DESIGN_TITLE_HEIGHT * ratio);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight);
llPage.addView(rlTitle, lp);
initTitle(rlTitle, ratio);
RelativeLayout rlBody = new RelativeLayout(activity);
rlBody.setBackgroundColor(0xffffffff);
lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
llPage.addView(rlBody, lp);
initBody(rlBody, ratio);
LinearLayout llShadow = new LinearLayout(activity);
llShadow.setOrientation(LinearLayout.VERTICAL);
rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
initShadow(llShadow, ratio);
llBottom = new LinearLayout(activity);
llBottom.setOrientation(LinearLayout.VERTICAL);
lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
llPage.addView(llBottom, lp);
initBottom(llBottom, ratio);
}
项目:POCenter
文件:EditPageLand.java
private void initBottom(LinearLayout llBottom, float ratio) {
LinearLayout llAt = new LinearLayout(activity);
llAt.setPadding(0, 0, 0, 5);
llAt.setBackgroundColor(0xffffffff);
int bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, bottomHeight);
llBottom.addView(llAt, lp);
tvAt = new TextView(activity);
tvAt.setTextColor(0xff3b3b3b);
tvAt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
tvAt.setGravity(Gravity.BOTTOM);
tvAt.setText("@");
int padding = (int) (DESIGN_LEFT_PADDING * ratio);
tvAt.setPadding(padding, 0, padding, 0);
lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
llAt.addView(tvAt, lp);
tvAt.setOnClickListener(this);
if (isShowAtUserLayout(platform.getName())) {
tvAt.setVisibility(View.VISIBLE);
} else {
tvAt.setVisibility(View.INVISIBLE);
}
tvTextCouter = new TextView(activity);
tvTextCouter.setTextColor(0xff3b3b3b);
tvTextCouter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
tvTextCouter.setGravity(Gravity.BOTTOM | Gravity.RIGHT);
onTextChanged(etContent.getText(), 0, 0, 0);
tvTextCouter.setPadding(padding, 0, padding, 0);
lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
lp.weight = 1;
llAt.addView(tvTextCouter, lp);
View v = new View(activity);
v.setBackgroundColor(0xffcccccc);
int px_1 = ratio > 1 ? ((int) ratio) : 1;
lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px_1);
llBottom.addView(v, lp);
}
项目:letv
文件:LetvUtil.java
public static void setListViewHeightBasedOnChildren(ListView listView) {
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter != null) {
int totalHeight = 0;
for (int i = 0; i < listAdapter.getCount(); i++) {
View listItem = listAdapter.getView(i, null, listView);
listItem.measure(0, 0);
totalHeight += listItem.getMeasuredHeight();
}
LayoutParams params = listView.getLayoutParams();
params.height = (listView.getDividerHeight() * (listAdapter.getCount() - 1)) + totalHeight;
listView.setLayoutParams(params);
}
}
项目:chromium-for-android-56-debug-video
文件:ChromeFullscreenManager.java
private void applyMarginToFullChildViews(ViewGroup contentView, float margin) {
for (int i = 0; i < contentView.getChildCount(); i++) {
View child = contentView.getChildAt(i);
if (!(child.getLayoutParams() instanceof FrameLayout.LayoutParams)) continue;
FrameLayout.LayoutParams layoutParams =
(FrameLayout.LayoutParams) child.getLayoutParams();
if (layoutParams.height == LayoutParams.MATCH_PARENT
&& layoutParams.topMargin != (int) margin) {
layoutParams.topMargin = (int) margin;
child.requestLayout();
TraceEvent.instant("FullscreenManager:child.requestLayout()");
}
}
}
项目:cordova-vuetify
文件:SystemWebChromeClient.java
@Override
/**
* Ask the host application for a custom progress view to show while
* a <video> is loading.
* @return View The progress view.
*/
public View getVideoLoadingProgressView() {
if (mVideoProgressView == null) {
// Create a new Loading view programmatically.
// create the linear layout
LinearLayout layout = new LinearLayout(parentEngine.getView().getContext());
layout.setOrientation(LinearLayout.VERTICAL);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
layout.setLayoutParams(layoutParams);
// the proress bar
ProgressBar bar = new ProgressBar(parentEngine.getView().getContext());
LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
barLayoutParams.gravity = Gravity.CENTER;
bar.setLayoutParams(barLayoutParams);
layout.addView(bar);
mVideoProgressView = layout;
}
return mVideoProgressView;
}
项目:yyox
文件:EditPageLand.java
public void onCreate() {
super.onCreate();
int screenHeight = ResHelper.getScreenHeight(activity);
float ratio = ((float) screenHeight) / DESIGN_SCREEN_WIDTH;
maxBodyHeight = 0;
llPage = new LinearLayout(activity);
llPage.setOrientation(LinearLayout.VERTICAL);
activity.setContentView(llPage);
rlTitle = new RelativeLayout(activity);
rlTitle.setBackgroundColor(0xffe6e9ec);
int titleHeight = (int) (DESIGN_TITLE_HEIGHT_L * ratio);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight);
llPage.addView(rlTitle, lp);
initTitle(rlTitle, ratio);
RelativeLayout rlBody = new RelativeLayout(activity);
rlBody.setBackgroundColor(0xffffffff);
lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
llPage.addView(rlBody, lp);
initBody(rlBody, ratio);
LinearLayout llShadow = new LinearLayout(activity);
llShadow.setOrientation(LinearLayout.VERTICAL);
rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
initShadow(llShadow, ratio);
llBottom = new LinearLayout(activity);
llBottom.setOrientation(LinearLayout.VERTICAL);
lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
llPage.addView(llBottom, lp);
initBottom(llBottom, ratio);
}