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


Java RelativeLayout.getContext方法代碼示例

本文整理匯總了Java中android.widget.RelativeLayout.getContext方法的典型用法代碼示例。如果您正苦於以下問題:Java RelativeLayout.getContext方法的具體用法?Java RelativeLayout.getContext怎麽用?Java RelativeLayout.getContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.RelativeLayout的用法示例。


在下文中一共展示了RelativeLayout.getContext方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.widget.RelativeLayout; //導入方法依賴的package包/類
@Override

        protected void onCreate(Bundle savedInstanceState) {

            super.onCreate(savedInstanceState);
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//強製豎屏
            final VideoView vv=new VideoView(this.getContext());
            RelativeLayout rlmain=new RelativeLayout(this.getContext());
            this.setContentView(vv);
            TextView txt=new TextView(rlmain.getContext());
            rlmain.addView(txt);
            txt.setText("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
//            rlmain.setBackgroundColor(Color.RED);
            vv.setVideoPath("/sdcard/mwwyt.mpg");
            vv.start();

            vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
                @Override
                public void onCompletion(MediaPlayer mp) {
                    vv.start();
                }
            });


        }
 
開發者ID:yippeesoft,項目名稱:NotifyTools,代碼行數:26,代碼來源:MainActivity.java

示例2: createClassicViews

import android.widget.RelativeLayout; //導入方法依賴的package包/類
static void createClassicViews(RelativeLayout layout) {
    TextView textViewTitle = new TextView(layout.getContext());
    textViewTitle.setId(me.dkzwm.widget.srl.ext.classic.R.id.sr_classic_title);
    textViewTitle.setTextSize(12);
    textViewTitle.setTextColor(Color.parseColor("#333333"));
    TextView textViewLastUpdate = new TextView(layout.getContext());
    textViewLastUpdate.setId(me.dkzwm.widget.srl.ext.classic.R.id.sr_classic_last_update);
    textViewLastUpdate.setTextSize(10);
    textViewLastUpdate.setTextColor(Color.parseColor("#969696"));
    textViewLastUpdate.setVisibility(View.GONE);
    LinearLayout textContainer = new LinearLayout(layout.getContext());
    textContainer.setOrientation(LinearLayout.VERTICAL);
    textContainer.setGravity(Gravity.CENTER_HORIZONTAL);
    textContainer.setId(me.dkzwm.widget.srl.ext.classic.R.id.sr_classic_text_container);
    LinearLayout.LayoutParams textViewTitleLP = new LinearLayout.LayoutParams(ViewGroup
            .LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    textContainer.addView(textViewTitle, textViewTitleLP);
    LinearLayout.LayoutParams textViewLastUpdateLP = new LinearLayout.LayoutParams(ViewGroup
            .LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    textContainer.addView(textViewLastUpdate, textViewLastUpdateLP);
    RelativeLayout.LayoutParams textContainerLP = new RelativeLayout.LayoutParams(ViewGroup
            .LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    textContainerLP.addRule(RelativeLayout.CENTER_IN_PARENT);
    layout.addView(textContainer, textContainerLP);
    ImageView imageViewArrow = new ImageView(layout.getContext());
    imageViewArrow.setId(me.dkzwm.widget.srl.ext.classic.R.id.sr_classic_arrow);
    RelativeLayout.LayoutParams imageViewArrowLP = new RelativeLayout.LayoutParams(ViewGroup
            .LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    final int dp6 = PixelUtl.dp2px(layout.getContext(), 6);
    imageViewArrowLP.setMargins(dp6, dp6, dp6, dp6);
    imageViewArrowLP.addRule(RelativeLayout.LEFT_OF, me.dkzwm.widget.srl.ext.classic.R.id
            .sr_classic_text_container);
    imageViewArrowLP.addRule(RelativeLayout.CENTER_VERTICAL);
    layout.addView(imageViewArrow, imageViewArrowLP);
    ProgressBar progressBar = new ProgressBar(layout.getContext(), null, android.R.attr
            .progressBarStyleSmallInverse);
    progressBar.setId(me.dkzwm.widget.srl.ext.classic.R.id.sr_classic_progress);
    RelativeLayout.LayoutParams progressBarLP = new RelativeLayout.LayoutParams(ViewGroup
            .LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    progressBarLP.setMargins(dp6, dp6, dp6, dp6);
    progressBarLP.addRule(RelativeLayout.LEFT_OF, me.dkzwm.widget.srl.ext.classic.R.id
            .sr_classic_text_container);
    progressBarLP.addRule(RelativeLayout.CENTER_VERTICAL);
    layout.addView(progressBar, progressBarLP);
}
 
開發者ID:dkzwm,項目名稱:SmoothRefreshLayout,代碼行數:46,代碼來源:ClassicConfig.java

示例3: ScrollerPager

import android.widget.RelativeLayout; //導入方法依賴的package包/類
public ScrollerPager(RelativeLayout mContainer, TitleView mTitleView, List<AdPageInfo> infos) {
    super(mContainer.getContext());

    this.mContainer = mContainer;
    this.mTitleView = mTitleView;

    if (null != infos) {
        this.mInfos = infos;
    } else {
        this.mInfos = new ArrayList<>();
    }

    init();
}
 
開發者ID:ryanlijianchang,項目名稱:AdPlayBanner,代碼行數:15,代碼來源:ScrollerPager.java


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