当前位置: 首页>>代码示例>>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;未经允许,请勿转载。