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


Java LayoutParams類代碼示例

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

示例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;

		}
 
開發者ID:lbbniu,項目名稱:CCDownload,代碼行數:25,代碼來源:PopMenu.java

示例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)));
	}
 
開發者ID:lbbniu,項目名稱:CCDownload,代碼行數:18,代碼來源:PopMenu.java

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

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

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

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

示例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;

}
 
開發者ID:89luca89,項目名稱:ThunderMusic,代碼行數:27,代碼來源:ColorPickerPreference.java

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

示例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;
    }
}
 
開發者ID:ccfish86,項目名稱:sctalk,代碼行數:22,代碼來源:MessageActivity.java

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

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

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

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

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


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