当前位置: 首页>>代码示例>>Java>>正文


Java LinearLayout类代码示例

本文整理汇总了Java中android.widget.LinearLayout的典型用法代码示例。如果您正苦于以下问题:Java LinearLayout类的具体用法?Java LinearLayout怎么用?Java LinearLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LinearLayout类属于android.widget包,在下文中一共展示了LinearLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAccessoryView

import android.widget.LinearLayout; //导入依赖的package包/类
private static ImageView getAccessoryView(ATableViewCell cell, ATableViewCellAccessoryType accessoryType) {
    LinearLayout containerView = (LinearLayout) cell.findViewById(R.id.containerView);

    // check if accessoryView already exists for current cell before creating a new instance.
    ImageView accessoryView = (ImageView) containerView.findViewById(R.id.accessoryView);
    if (accessoryView == null) {
        Resources res = cell.getResources();

        // get marginRight for accessoryView, DisclosureButton has a different one.
        LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
        int marginRight = (int) res.getDimension(R.dimen.atv_cell_content_margin);
        if (accessoryType == ATableViewCellAccessoryType.DisclosureButton) {
            marginRight = (int) res.getDimension(R.dimen.atv_cell_disclosure_button_margin_right);
        }
        params.setMargins(0, 0, marginRight, 0);

        // setup.
        accessoryView = new ATableViewCellAccessoryView(cell.getContext());
        accessoryView.setId(R.id.accessoryView);
        accessoryView.setLayoutParams(params);

        containerView.addView(accessoryView);
    }

    return accessoryView;
}
 
开发者ID:hh-in-zhuzhou,项目名称:ShangHanLun,代码行数:27,代码来源:ATableViewCellAccessoryView.java

示例2: getViews

import android.widget.LinearLayout; //导入依赖的package包/类
@Override
    public void getViews() {
        mProjectionBtn = (TextView) findViewById(R.id.tv_projectin_btn);
        mBackBtn = (LinearLayout) findViewById(R.id.ll_slide_back);
        mViewPager = (LoopViewPager) findViewById(R.id.viewpager);
        finsh = (LinearLayout) findViewById(R.id.ll_slide_finish);
        mCurrentPaeTv = (TextView) findViewById(R.id.tv_current_page);
        tv_current_type = (TextView) findViewById(R.id.tv_current_type);
        mSectorMenu = (SectorMenuButton) findViewById(R.id.sectorMenuBtn);
        mSlideAdapter = new SlideAdapter(this);
        mSlideAdapter.setData(mSlideList);
        mViewPager.setAdapter(mSlideAdapter);
        mViewPager.setOnPageChangeListener(this);
        currentPager = mDefaultPosition;
//        mViewPager.setCurrentItem(currentPager, false);
        mPauseBtn = (ImageView) findViewById(R.id.iv_pause);
    }
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:18,代码来源:SlidesActivity.java

示例3: ViewHolder

import android.widget.LinearLayout; //导入依赖的package包/类
public ViewHolder(final View itemView) {
    super(itemView);
    tv_nameCn = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_top_left);
    tv_down_left = (AlwaysMarqueeTextView) itemView.findViewById(R.id.tv_down_left);
    tv_country = (AppCompatTextView) itemView.findViewById(R.id.tv_top_right);
    tv_status = (AppCompatTextView) itemView.findViewById(R.id.tv_down_right);

    ll_content = (LinearLayout) itemView.findViewById(R.id.ll_content);
    ll_content.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            T_ContactsCompanyEntity.RowsEntity rowsEntity = list.get(getLayoutPosition());
            T_ContactsCompanyDetailsActivity_.intent(T_ContactsCompanyListFragment.this).extra(AppDelegate.ROWS_ENTITY, rowsEntity).start();
        }
    });
}
 
开发者ID:jpaijh,项目名称:TYT,代码行数:17,代码来源:T_ContactsCompanyListFragment.java

示例4: initView

import android.widget.LinearLayout; //导入依赖的package包/类
/**
 * Initialize view
 */
public void initView() {
    isInitialized = true;
    removeAllViews();
    setOrientation(VERTICAL);
    setGravity(Gravity.BOTTOM);
    setBackgroundColor(headerBackgroundColor);

    LinearLayout mContainer = viewHelper.generateContainerLayout();
    addView(mContainer);

    characterViewList = viewHelper.generateCharacterViewList(headerText);
    for (TextView textView : characterViewList) {
        mContainer.addView(textView);
    }

    setupAnimation();
}
 
开发者ID:HarinTrivedi,项目名称:AnimatedPullToRefresh-master,代码行数:21,代码来源:CharacterAnimatorHeaderView.java

示例5: addMessageBox

import android.widget.LinearLayout; //导入依赖的package包/类
public void addMessageBox(String message, int type){
    TextView textView = new TextView(ChatActivity.this);
    textView.setText(message);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lp.setMargins(0, 0, 0, 10);
    textView.setLayoutParams(lp);

    if(type == 1) {
        textView.setBackgroundResource(R.drawable.rounded_corner1);
    }
    else{
        textView.setBackgroundResource(R.drawable.rounded_corner2);
    }

    mLinearlayout.addView(textView);
    mScrollview.fullScroll(View.FOCUS_DOWN);
}
 
开发者ID:PacktPublishing,项目名称:Android-Wear-Projects,代码行数:18,代码来源:ChatActivity.java

示例6: SlidingTabLayout

import android.widget.LinearLayout; //导入依赖的package包/类
public SlidingTabLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setFillViewport(true);//设置滚动视图是否可以伸缩其内容以填充视口
    setWillNotDraw(false);//重写onDraw方法,需要调用这个方法来清除flag
    setClipChildren(false);
    setClipToPadding(false);

    this.mContext = context;
    mTabsContainer = new LinearLayout(context);
    addView(mTabsContainer);

    obtainAttributes(context, attrs);

    //get layout_height
    String height = attrs.getAttributeValue("http://schemas.android.com/apk/res/android", "layout_height");

    if (height.equals(ViewGroup.LayoutParams.MATCH_PARENT + "")) {
    } else if (height.equals(ViewGroup.LayoutParams.WRAP_CONTENT + "")) {
    } else {
        int[] systemAttrs = {android.R.attr.layout_height};
        TypedArray a = context.obtainStyledAttributes(attrs, systemAttrs);
        mHeight = a.getDimensionPixelSize(0, ViewGroup.LayoutParams.WRAP_CONTENT);
        a.recycle();
    }
}
 
开发者ID:767954322,项目名称:FlycoTabLayout,代码行数:26,代码来源:SlidingTabLayout.java

示例7: showCenterToast

import android.widget.LinearLayout; //导入依赖的package包/类
public static void showCenterToast(Context context, String title, @DrawableRes int drawableId, int duration) {
    Toast toast = makeText(context.getApplicationContext(), title, duration);
    toast.setGravity(Gravity.CENTER, 0, 0);
    View view = LayoutInflater.from(context).inflate(R.layout.layout_center_toast, null);
    LinearLayout rlContent = (LinearLayout) view.findViewById(R.id.rl_content);
    TextView content = (TextView) view.findViewById(R.id.tv_content);
    ImageView alertIcon = (ImageView) view.findViewById(R.id.iv_icon);
    if (drawableId != 0) {
        alertIcon.setVisibility(View.VISIBLE);
        alertIcon.setImageResource(drawableId);
    } else {
        alertIcon.setVisibility(View.GONE);
    }
    if (!TextUtils.isEmpty(title)) {
        content.setText(title);
    }
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    int screenWidth = wm.getDefaultDisplay().getWidth();
    int width = (int) (screenWidth / 2f);
    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) rlContent.getLayoutParams();
    lp.width = width;
    rlContent.setLayoutParams(lp);
    rlContent.requestLayout();
    toast.setView(view);
    toast.show();
}
 
开发者ID:Jusenr,项目名称:androidtools,代码行数:27,代码来源:ToastUtils.java

示例8: onCreate

import android.widget.LinearLayout; //导入依赖的package包/类
@Override
 public void onCreate(Bundle icicle) {
   super.onCreate(icicle);

   Window window = getWindow();
   window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
   viewLayout = new LinearLayout(this);
   viewLayout.setOrientation(LinearLayout.HORIZONTAL);
   frameLayout = new FrameLayout(this);
   frameLayout.addView(viewLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT));
   frameLayout.setBackgroundColor(0xFFFFFFFF); // COLOR_WHITE XXX

   setContentView(frameLayout);
   frameLayout.requestLayout();

   hasSurface = false;
 }
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:19,代码来源:AppInvCaptureActivity.java

示例9: PhotoPostVH

import android.widget.LinearLayout; //导入依赖的package包/类
public PhotoPostVH(View itemView) {
    super(itemView);
    context = itemView.getContext();
    avatarView = (SimpleDraweeView) itemView.findViewById(R.id.post_avatar);
    nameView = (TextView) itemView.findViewById(R.id.post_name);
    itemView.findViewById(R.id.post_header).setOnClickListener(this);
    timeView = (TextView) itemView.findViewById(R.id.post_time);
    sourceView = (TextView) itemView.findViewById(R.id.post_source);
    sourceView.setOnClickListener(this);
    contentLayout = (FlexboxLayout) itemView.findViewById(R.id.post_content);
    trailLayout = (LinearLayout) itemView.findViewById(R.id.post_trail);
    noteCountView = (TextView) itemView.findViewById(R.id.note_count);
    reblogView = (ImageView) itemView.findViewById(R.id.post_reblog);
    reblogView.setOnClickListener(this);
    likeView = (ImageView) itemView.findViewById(R.id.post_like);
    likeView.setOnClickListener(this);
    dividerWidth = (int) Utils.dp2Pixels(context, 4);
    deleteStub = (ViewStub) itemView.findViewById(R.id.stub_delete_forever);

    isSimpleMode = DataManager.getInstance().isSimpleMode();
    if (isSimpleMode) {
        trailLayout.setVisibility(View.GONE);
    }
}
 
开发者ID:mingdroid,项目名称:tumbviewer,代码行数:25,代码来源:PhotoPostVH.java

示例10: onCreate

import android.widget.LinearLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    LinearLayout root = new LinearLayout(this);
    root.setPadding(30, 30, 30, 30);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
    root.setLayoutParams(lp);

    setContentView(root);

    // textView
    TextView textView = new TextView(this);
    textView.setText("Theme: Dialog");
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(30);
    LinearLayout.LayoutParams lp2 = new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
    textView.setLayoutParams(lp2);
    root.addView(textView);
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:20,代码来源:ThemeDialogActivity.java

示例11: onViewCreated

import android.widget.LinearLayout; //导入依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {

    CommonIndicator mCommonIndicator=new CommonIndicator(this.getActivity());
    FrameLayout.LayoutParams lp=new FrameLayout.LayoutParams(-2,-2);
    lp.gravity= Gravity.CENTER;
    ProgressBar mProgressBar=new ProgressBar(this.getActivity());
    mProgressBar.setBackground(this.getResources().getDrawable(R.drawable.indicator_shape));
    mCommonIndicator.addView(mProgressBar,lp);

    this.mAgentWebX5 = AgentWebX5.with( this)//
            .setAgentWebParent((ViewGroup) view, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))//
            .setCustomIndicator(mCommonIndicator)
            .setWebSettings(WebDefaultSettingsManager.getInstance())//
            .setWebViewClient(mWebViewClient)
            .setReceivedTitleCallback(mCallback)
            .setSecurityType(AgentWebX5.SecurityType.strict)
            .createAgentWeb()//
            .ready()//
            .go(getUrl());


    initView(view);
}
 
开发者ID:Justson,项目名称:AgentWebX5,代码行数:26,代码来源:CustomIndicatorFragment.java

示例12: initView

import android.widget.LinearLayout; //导入依赖的package包/类
@Override
protected void initView(Bundle bundle) {
    super.initView(bundle);
    GlideManager.loadCircleImg("https://avatars3.githubusercontent.com/u/19605922?v=4&s=460", ivHead);
    titleBarDrawer.setImmersible(mContext, isImmersible, isLight);
    vHeader = View.inflate(mContext, R.layout.layout_title_header, null);
    sBtnImmersible = (SwitchCompat) vHeader.findViewById(R.id.sBtn_immersible);
    sBtnLight = (SwitchCompat) vHeader.findViewById(R.id.sBtn_light);
    sBtnLine = (SwitchCompat) vHeader.findViewById(R.id.sBtn_line);
    lLayoutAlpha = (LinearLayout) vHeader.findViewById(R.id.lLayout_alpha);
    sBarAlpha = (SeekBar) vHeader.findViewById(R.id.sBar_alpha);
    tvStatusAlpha = (TextView) vHeader.findViewById(R.id.tv_statusAlpha);
    initView();
    setDrawerList();
    initData();
}
 
开发者ID:AriesHoo,项目名称:TitleBarView,代码行数:17,代码来源:MainActivity.java

示例13: initWidgets

import android.widget.LinearLayout; //导入依赖的package包/类
private void initWidgets() {
    View view = LayoutInflater.from(getContext())
            .inflate(R.layout.view_tab_picker, this, false);

    mRecyclerActive = (RecyclerView) view.findViewById(R.id.view_recycler_active);
    mRecyclerInactive = (RecyclerView) view.findViewById(R.id.view_recycler_inactive);
    mViewScroller = (NestedScrollView) view.findViewById(R.id.view_scroller);
    mLayoutTop = (RelativeLayout) view.findViewById(R.id.layout_top);
    mViewWrapper = (LinearLayout) view.findViewById(R.id.view_wrapper);
    mViewDone = (TextView) view.findViewById(R.id.tv_done);
    mViewOperator = (TextView) view.findViewById(R.id.tv_operator);
    mLayoutWrapper = (LinearLayout) view.findViewById(R.id.layout_wrapper);
    mViewDone.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mViewDone.getText().toString().equals("排序删除")) {
                mActiveAdapter.startEditMode();
            } else {
                mActiveAdapter.cancelEditMode();
            }
        }
    });

    addView(view);
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:26,代码来源:TabPickerView.java

示例14: onCreate

import android.widget.LinearLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_cmb_china_login);
    /** init view **/

    mMainContainer = (LinearLayout) findViewById(R.id.activity_cmb_china_login);
    mCardNum = (BootstrapEditText) findViewById(R.id.user_card_num);
    mPassword = (BootstrapEditText) findViewById(R.id.user_password);
    mValidCode = (BootstrapEditText) findViewById(R.id.user_valid_code);
    valideCodeImage = (ImageView) findViewById(R.id.image_valid_code);

    valideCodeImage.setOnClickListener(this);
    mContext = this;

    loginBtn = (BootstrapButton) findViewById(R.id.loginCmbChinaBtn);
    loginBtn.setOnClickListener(this);

    httpRequestManager = HttpRequestManager.getInstance();
    updateValidCodeAction();
}
 
开发者ID:MarcusMa,项目名称:MyCreditCardDemo,代码行数:22,代码来源:CmbChinaLoginActivity.java

示例15: getNextFormula

import android.widget.LinearLayout; //导入依赖的package包/类
/*********************************************************
 * Helper static methods
 *********************************************************/

private static FormulaBase getNextFormula(LinearLayout l, int idx)
{
    if (idx == ViewUtils.INVALID_INDEX)
    {
        return null;
    }
    int targetIdx = ViewUtils.INVALID_INDEX;
    if (idx < l.getChildCount())
    {
        targetIdx = idx;
    }
    else if ((idx - 1) < l.getChildCount())
    {
        targetIdx = idx - 1;
    }
    else if (l.getChildCount() > 0)
    {
        targetIdx = l.getChildCount() - 1;
    }
    FormulaBase f = null;
    if (targetIdx != ViewUtils.INVALID_INDEX)
    {
        View v = l.getChildAt(targetIdx);
        if (v instanceof ListRow)
        {
            ListRow row = (ListRow) v;
            if (row.getChildCount() > 0)
            {
                v = row.getChildAt(0);
            }
        }
        if (v instanceof FormulaBase)
        {
            f = (FormulaBase) v;
        }
    }
    return f;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:43,代码来源:FormulaListView.java


注:本文中的android.widget.LinearLayout类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。