本文整理汇总了Java中android.widget.RelativeLayout.LayoutParams类的典型用法代码示例。如果您正苦于以下问题:Java LayoutParams类的具体用法?Java LayoutParams怎么用?Java LayoutParams使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LayoutParams类属于android.widget.RelativeLayout包,在下文中一共展示了LayoutParams类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ffmpeg_preview);
cancelBtn = (Button) findViewById(R.id.play_cancel);
cancelBtn.setOnClickListener(this);
DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
surfaceView = (TextureView) findViewById(R.id.preview_video);
RelativeLayout previewVideoParent = (RelativeLayout)findViewById(R.id.preview_video_parent);
LayoutParams layoutParams = (LayoutParams) previewVideoParent
.getLayoutParams();
layoutParams.width = displaymetrics.widthPixels;
layoutParams.height = displaymetrics.widthPixels;
previewVideoParent.setLayoutParams(layoutParams);
surfaceView.setSurfaceTextureListener(this);
surfaceView.setOnClickListener(this);
path = getIntent().getStringExtra("path");
imagePlay = (ImageView) findViewById(R.id.previre_play);
imagePlay.setOnClickListener(this);
mediaPlayer = new MediaPlayer();
mediaPlayer.setOnCompletionListener(this);
}
示例2: getView
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
RelativeLayout layoutView = new RelativeLayout(context);
TextView textView = new TextView(context);
textView.setTextSize(13);
textView.setText(itemList.get(position));
textView.setTag(position);
if (checkedPosition == position || itemList.size() == 1) {
// layoutView.setBackgroundColor(0x8033B5E5);
textView.setTextColor(context.getResources().getColor(R.color.rb_text_check));
} else {
textView.setTextColor(Color.WHITE);
}
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.CENTER_IN_PARENT);
layoutView.addView(textView, params);
layoutView.setMinimumHeight(ParamsUtil.dpToPx(context, 26));
return layoutView;
}
示例3: PopMenu
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
public PopMenu(Context context, int resid, int checkedPosition, int height) {
this.context = context;
this.checkedPosition = checkedPosition;
itemList = new ArrayList<String>();
RelativeLayout view = new RelativeLayout(context);
// view.setBackgroundResource(resid);
listView = new ListView(context);
listView.setPadding(0, ParamsUtil.dpToPx(context, 3), 0, ParamsUtil.dpToPx(context, 3));
view.addView(listView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
listView.setAdapter(new PopAdapter());
listView.setOnItemClickListener(this);
popupWindow = new PopupWindow(view, context.getResources().getDimensionPixelSize(R.dimen.popmenu_width), height);
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.argb(178, 0, 0, 0)));
}
示例4: onCreate
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
service = new Intent(this, UploadService.class);
inputLayout = new RelativeLayout(this);
inputLayout.setBackgroundColor(Color.WHITE);
inputLayout.setHorizontalGravity(Gravity.CENTER_HORIZONTAL);
inputLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
getCategory();
initView();
bindService(service, serviceConnection, Context.BIND_AUTO_CREATE);
String path = getIntent().getStringExtra("filePath");
if (path != null) {
filePath = path;
}
getActionBar().setDisplayHomeAsUpEnabled(true);
uploadButton.setOnClickListener(this);
setContentView(inputLayout);
}
示例5: onCreateView
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
activity = getActivity();
context = activity.getApplicationContext();
RelativeLayout downloadLayout = new RelativeLayout(activity.getApplicationContext());
downloadLayout.setBackgroundColor(Color.WHITE);
receiver = new DownloadedReceiver();
activity.registerReceiver(receiver, new IntentFilter(ConfigUtil.ACTION_DOWNLOADED));
downloadedListView = new ListView(context);
downloadedListView.setPadding(10, 10, 10, 10);
downloadedListView.setDivider(getResources().getDrawable(R.drawable.line));
LayoutParams downloadedLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
downloadLayout.addView(downloadedListView, downloadedLayoutParams);
initData();
downloadedListView.setOnItemClickListener(onItemClickListener);
downloadedListView.setOnCreateContextMenuListener(onCreateContextMenuListener);
return downloadLayout;
}
示例6: init
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
private void init(Context context, AttributeSet attrs) {
try {
this.mJarClassLoader = JarLoader.getJarClassLoader(context, "Letv_Ads.apk", JarConstant.LETV_ADS_PACKAGENAME);
this.mJarResources = JarResources.getResourceByCl(this.mJarClassLoader, context);
mLoadClass = JarLoader.loadClass(context, "Letv_Ads.apk", JarConstant.LETV_ADS_PACKAGENAME, JarConstant.LETV_ADS_VIEW_CLASS);
Constructor<?> localConstructor = mLoadClass.getConstructor(new Class[]{Context.class, AttributeSet.class, Resources.class});
if (this.mJarResources != null) {
updateConfiguration(this.mJarResources.getResources());
this.mRemoteView = (RelativeLayout) localConstructor.newInstance(new Object[]{context, attrs, this.mJarResources.getResources()});
}
} catch (Exception e) {
e.printStackTrace();
LogInfo.log(TAG, "Exception e=" + e.toString());
}
if (this.mRemoteView != null) {
LogInfo.log(TAG, "addView mRemoteView=" + this.mRemoteView);
addView(this.mRemoteView, new LayoutParams(-1, -1));
}
}
示例7: showDeleteLayout
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
protected void showDeleteLayout() {
if (getActivity() != null && this.mHeaderLayout != null) {
LayoutParams params = (LayoutParams) this.mPullListView.getLayoutParams();
if (!this.mIsDelete || this.mListAdapter == null || this.mListAdapter.getCount() <= 0) {
params.bottomMargin = 0;
this.mHeaderLayout.setVisibility(8);
upDateLogin();
return;
}
this.mHeaderLayout.setVisibility(0);
if (this.mHeaderLayout.getHeight() == 0) {
params.bottomMargin = ((UIs.zoomRealHeight(50) * 3) / 4) + 1;
} else {
params.bottomMargin = this.mHeaderLayout.getHeight();
}
this.mPullListView.setLayoutParams(params);
}
}
示例8: onCreateDialogView
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
@Override
protected View onCreateDialogView() {
RelativeLayout relativeLayout = new RelativeLayout(getContext());
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
layoutParams.addRule(RelativeLayout.BELOW, 2);
LayoutParams layoutParamsText = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParamsText.addRule(RelativeLayout.ALIGN_PARENT_TOP);
layoutParamsText.addRule(RelativeLayout.CENTER_HORIZONTAL);
colorPickerView = new ColorPicker(getContext());
colorPickerView.setId(1);
currentColor = new TextView(getContext());
currentColor.setTextSize(16);
currentColor.setId(2);
relativeLayout.addView(colorPickerView, layoutParams);
relativeLayout.addView(currentColor, layoutParamsText);
return relativeLayout;
}
示例9: addTab
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
protected void addTab(int index, CharSequence text, int iconResId) {
TabView tabView = new TabView(this, getContext(), text);
tabView.setIndex(index);
tabView.setFocusable(true);
tabView.setOnClickListener(this.mTabClickListener);
if (iconResId != 0) {
tabView.setCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0);
}
int width = this.mMeanWidth == -1 ? getTabWidth(text) : this.mMeanWidth;
if (this.mMeanWidth != -1) {
tabView.setSize(this.mMeanWidth, UIsUtils.dipToPx(38.0f));
} else {
tabView.setSize(width, UIsUtils.dipToPx(38.0f));
}
RelativeLayout relativeLayout = new RelativeLayout(this.mContext);
relativeLayout.setGravity(17);
relativeLayout.setLayoutParams(new LayoutParams(-2, UIsUtils.dipToPx(38.0f)));
LayoutParams params = new LayoutParams(-2, UIsUtils.dipToPx(38.0f));
params.setMargins(TAB_MARGIN, 0, TAB_MARGIN, 0);
tabView.setLayoutParams(params);
relativeLayout.addView(tabView);
if (this.mIsHome) {
ThemeDataManager.getInstance(this.mContext).setContentTheme(tabView, ThemeDataManager.NAME_TOP_NAVIGATION_COLOR);
}
ImageView imageView = new ImageView(this.mContext);
LayoutParams imageViewParams = new LayoutParams(width, UIsUtils.dipToPx(2.0f));
imageViewParams.setMargins(TAB_MARGIN, UIsUtils.dipToPx(36.0f), TAB_MARGIN, 0);
imageView.setLayoutParams(imageViewParams);
relativeLayout.addView(imageView);
imageView.setBackgroundDrawable(getResources().getDrawable(2130838177));
if (this.mIsHome) {
ThemeDataManager.getInstance(this.mContext).setShapeSelectorViewTheme(imageView, ThemeDataManager.NAME_TOP_NAVIGATION_COLOR, 2, true);
}
this.mTabLayout.addView(relativeLayout);
}
示例10: onGlobalLayout
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
@Override
public void onGlobalLayout() {
Rect r = new Rect();
baseRoot.getGlobalVisibleRect(r);
// 进入Activity时会布局,第一次调用onGlobalLayout,先记录开始软键盘没有弹出时底部的位置
if (rootBottom == Integer.MIN_VALUE) {
rootBottom = r.bottom;
return;
}
// adjustResize,软键盘弹出后高度会变小
if (r.bottom < rootBottom) {
//按照键盘高度设置表情框和发送图片按钮框的高度
keyboardHeight = rootBottom - r.bottom;
SystemConfigSp.instance().init(MessageActivity.this);
SystemConfigSp.instance().setIntConfig(currentInputMethod, keyboardHeight);
LayoutParams params = (LayoutParams) addOthersPanelView.getLayoutParams();
params.height = keyboardHeight;
LayoutParams params1 = (LayoutParams) emoLayout.getLayoutParams();
params1.height = keyboardHeight;
}
}
示例11: initWebView
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
private void initWebView() {
if (this.mWebView == null) {
this.mWebView = new WebView(this);
this.mWebView.setBackgroundColor(-1);
this.rootView.addView(this.mWebView, new LayoutParams(-1, -1));
this.mWebView.getSettings().setUseWideViewPort(true);
this.mWebView.getSettings().setSupportZoom(true);
this.mWebView.getSettings().setBuiltInZoomControls(true);
this.mWebView.setVerticalScrollBarEnabled(true);
this.mWebView.setHorizontalScrollBarEnabled(true);
this.mWebView.getSettings().setJavaScriptEnabled(true);
this.mWebView.getSettings().setDomStorageEnabled(true);
this.mWebView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
AlbumPlayActivity.this.mWebView.loadUrl(url);
return super.shouldOverrideUrlLoading(view, url);
}
});
this.mWebView.setClickable(false);
}
}
示例12: addMirrorView
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
private ImageView addMirrorView(ViewGroup parent, RecyclerView recyclerView, View view) {
view.destroyDrawingCache();
view.setDrawingCacheEnabled(true);
ImageView mirrorView = new ImageView(recyclerView.getContext());
Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache());
mirrorView.setImageBitmap(bitmap);
view.setDrawingCacheEnabled(false);
int[] locations = new int[2];
view.getLocationOnScreen(locations);
int[] parenLocations = new int[2];
recyclerView.getLocationOnScreen(parenLocations);
LayoutParams params = new LayoutParams(bitmap.getWidth(), bitmap.getHeight());
params.setMargins(locations[0], (locations[1] - parenLocations[1]) + UIsUtils.dipToPx(44.0f), 0, 0);
parent.addView(mirrorView, params);
return mirrorView;
}
示例13: initNavigationBar
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
private void initNavigationBar() {
RelativeLayout my_playrecrod_content = (RelativeLayout) findViewById(R.id.my_collect_content);
LayoutParams params = (LayoutParams) my_playrecrod_content.getLayoutParams();
params.bottomMargin = 0;
my_playrecrod_content.setLayoutParams(params);
this.mBackImageView = (ImageView) findViewById(2131362351);
this.mEditView = (TextView) findViewById(2131362354);
this.mEditView.setText(2131099788);
this.mEditView.setTextColor(this.mContext.getResources().getColor(2131493261));
this.mTitleView = (TextView) findViewById(2131362352);
this.mLoginTip = (RelativeLayout) findViewById(R.id.my_collect_bottom_login_btn);
this.mLoginTip.setVisibility(8);
this.mTitleView.setText(getResources().getString(2131100479));
this.mBackImageView.setOnClickListener(this.onClickEvent);
this.mTitleView.setOnClickListener(this.onClickEvent);
this.mEditView.setOnClickListener(this.onClickEvent);
}
示例14: initHeaderView
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
private void initHeaderView() {
this.mHeaderView = (RelativeLayout) LayoutInflater.from(getContext()).inflate(R.layout.view_live_header, null);
this.mViewpager = (ViewPager) this.mHeaderView.findViewById(R.id.view_live_header_viewpager);
this.mRecyclerview = (RecyclerView) this.mHeaderView.findViewById(R.id.view_live_header_recyclerview);
this.mIvSingle = (ImageView) this.mHeaderView.findViewById(R.id.view_live_header_iv_single);
this.mIvDouble = (ImageView) this.mHeaderView.findViewById(R.id.view_live_header_iv_double);
this.mHeaderView.setClipChildren(false);
int width = UIsUtils.getScreenWidth() - UIsUtils.dipToPx(40.0f);
this.mViewPagerHeight = (width * 240) / 320;
LayoutParams params = (LayoutParams) this.mViewpager.getLayoutParams();
params.width = width;
params.height = this.mViewPagerHeight;
this.mViewpager.setLayoutParams(params);
initHeaderImageView();
initViewPager();
initRecyclerView();
this.mListView.addHeaderView(this.mHeaderView);
}
示例15: initBarrageLayout
import android.widget.RelativeLayout.LayoutParams; //导入依赖的package包/类
private void initBarrageLayout() {
this.mBarrageContainId = GenerateViewId.generateViewId();
LayoutParams params = new LayoutParams(-1, -1);
View view = LayoutInflater.from(this.mContext).inflate(R.layout.live_barrage_contain, null);
view.setId(this.mBarrageContainId);
addView(view, params);
}