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


Java ConstraintLayout类代码示例

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


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

示例1: addPlayer

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
public void addPlayer(View view) {
    EditText newNameText = (EditText) findViewById(R.id.newNameText);
    String newName = newNameText.getText().toString();
    newNameText.setText("");

    if (newName.length() > 0 && playerNum < maxNum) {
        shiftPlayersDown();

        TextView playerName = (TextView) findViewById(playerTextIds.get(0));
        playerName.setText(newName);

        ConstraintLayout playerLayout = (ConstraintLayout) findViewById(playerLayoutIds.get(playerNum));
        playerLayout.setVisibility(View.VISIBLE);

        playerNum++;
    }
}
 
开发者ID:agware,项目名称:UpAndDown,代码行数:18,代码来源:AddPlayersActivity.java

示例2: removePlayer

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
public void removePlayer(View view) {
    int playerIndex = -1;
    for(int i = 0; i < playerNum; i++) {
        if (view.getId() == playerButtonIds.get(i)) {
            playerIndex = i;
            break;
        }
    }

    if (playerIndex >= 0) {
        shiftPlayersUp(playerIndex);

        playerNum--;
        ConstraintLayout playerLayout = (ConstraintLayout) findViewById(playerLayoutIds.get(playerNum));
        playerLayout.setVisibility(View.INVISIBLE);
    }
}
 
开发者ID:agware,项目名称:UpAndDown,代码行数:18,代码来源:AddPlayersActivity.java

示例3: initViews

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
/**
 * This method will create the view object from XLM to Java and instanciate objects. Used when the user reboots it's device
 *
 */
private void initViews() {
    //init graphical element
    txtViewGlucose=(TextView)view.findViewById(R.id.txtView_GlucoseValue);
    txtViewPulse=(TextView)view.findViewById(R.id.txtView_pulseValue);
    txtViewSystol=(TextView)view.findViewById(R.id.txtView_systolValue);
    txtViewDiastol=(TextView)view.findViewById(R.id.txtView_DiastolValue);
    txtViewSteps=(TextView)view.findViewById(R.id.txtView_stepValue);
    txtViewWeight=(TextView)view.findViewById(R.id.txtView_weightValue);

    //create the bar object
    barPulse=(ConstraintLayout)view.findViewById(R.id.bar_pulse);
    barGlucose=(ConstraintLayout)view.findViewById(R.id.bar_glucose);
    barSystol=(ConstraintLayout)view.findViewById(R.id.bar_sys);
    barDiastol=(ConstraintLayout)view.findViewById(R.id.bar_dias);
    barStep=(ConstraintLayout)view.findViewById(R.id.bar_step);
    barWeight=(ConstraintLayout)view.findViewById(R.id.bar_weight);

    imgGlucose=(ImageButton) view.findViewById(R.id.img_severity_glucose);
    imgPulse=(ImageButton) view.findViewById(R.id.img_severity_pulse);
    imgPressure=(ImageButton)view.findViewById(R.id.img_severity_pressure);
    imgStep=(ImageButton)view.findViewById(R.id.img_severity_step);
    imgWeight=(ImageButton)view.findViewById(R.id.img_severity_weight);
}
 
开发者ID:kflauri2312lffds,项目名称:Android_watch_magpie,代码行数:28,代码来源:FragmentHome.java

示例4: onDoubleTap

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
@Override
public boolean onDoubleTap(MotionEvent event) {
    Log.d(DEBUG_TAG, "onDoubleTap: " + event.toString());
    ConstraintLayout bimg = (ConstraintLayout) findViewById(R.id.layout);
    String background = String.valueOf(bimg.getTag());
    if (background.equals("img")) {
        bimg.setBackgroundResource(R.drawable.wallp);
        bimg.setTag("wallp");
    } else {
        if (background.equals("wallp")) {
            bimg.setBackgroundResource(R.drawable.fond);
            bimg.setTag("fond");
        } else {
            if (background.equals("fond")) {
                bimg.setBackgroundResource(R.drawable.img);
                bimg.setTag("img");
            }
        }
    }
    return true;
}
 
开发者ID:Jayant11,项目名称:LockScreen-Oreo,代码行数:22,代码来源:LockedScreen.java

示例5: onCreate

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.constraintset_example_main);

    mRootLayout = (ConstraintLayout) findViewById(R.id.activity_constraintset_example);
    // Note that this can also be achieved by calling
    // `mConstraintSetNormal.load(this, R.layout.constraintset_example_main);`
    // Since we already have an inflated ConstraintLayout in `mRootLayout`, clone() is
    // faster and considered the best practice.
    mConstraintSetNormal.clone(mRootLayout);
    // Load the constraints from the layout where ImageView is enlarged.
    mConstraintSetBig.load(this, R.layout.constraintset_example_big);

    if (savedInstanceState != null) {
        boolean previous = savedInstanceState.getBoolean(SHOW_BIG_IMAGE);
        if (previous != mShowBigImage) {
            mShowBigImage = previous;
            applyConfig();
        }
    }
}
 
开发者ID:googlesamples,项目名称:android-ConstraintLayoutExamples,代码行数:23,代码来源:ConstraintSetExampleActivity.java

示例6: reloadImages

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
private void reloadImages( final ConstraintLayout fab, final DatabaseReference ref, final String uid ) {
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ref.addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot snapshot) {
                    clearPicList();

                    updatePicList( snapshot, uid );

                    gridAdapter.notifyDataSetChanged();
                    gridView.invalidateViews();
                    ref.removeEventListener(this);
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {
                    ref.removeEventListener(this);
                }
            });
        }
    });
}
 
开发者ID:chrisqz95,项目名称:couch-potatoes,代码行数:25,代码来源:PictureGridActivity.java

示例7: DataViewHolder

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
DataViewHolder(final View itemView) {
    super(itemView);
    textView = (TextView) itemView.findViewById(tv);
    imageView = (ImageView) itemView.findViewById(R.id.iv);
    packageInfo = (TextView) itemView.findViewById(R.id.packageName);

    share = (Button) itemView.findViewById(R.id.shareApk);
    uninstall = (Button) itemView.findViewById(R.id.uninstallApk);
    extract = (Button) itemView.findViewById(R.id.extractApk);

    expandableView = (ConstraintLayout) itemView.findViewById(R.id.expandableView);

    share.setOnClickListener(this);
    uninstall.setOnClickListener(this);
    extract.setOnClickListener(this);

}
 
开发者ID:HitRoxxx,项目名称:FloatingNew,代码行数:18,代码来源:RecyclerViewAdapterSelectedApp.java

示例8: setContentView

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
private void setContentView() {
    int _padding = NumberUtil.get_px(getContext(), 15);
    setPadding(_padding, _padding, _padding, _padding);
    inflate(getContext(), R.layout.widget_sdcard_percent, this);

    _line = (ConstraintLayout) findViewById(R.id.block_percent);
    _text_system = (TextView) findViewById(R.id.textView_count_system);
    _text_blank = (TextView) findViewById(R.id.textView_count_blank);
    _text_file = (TextView) findViewById(R.id.textView_count_file);
    _text_rubbish = (TextView) findViewById(R.id.textView_count_rubbish);

    for (int _temp_i = 0; _temp_i < _line.getChildCount() && _line.getChildAt(_temp_i).getId() == -1; _temp_i++) {
        _line.getChildAt(_temp_i).setId(_temp_i);
    }
    _set_line.clone(_line);
}
 
开发者ID:bonepeople,项目名称:SDCardCleaner,代码行数:17,代码来源:SDCardPercent.java

示例9: bind

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
public void bind(final Item item) {
    mTextLabel.setText(item.getLabel());
    ConstraintLayout.LayoutParams layoutParamsTextLabel = (ConstraintLayout.LayoutParams) mTextLabel.getLayoutParams();
    if (item.getPercent() > LABEL_POSITION_CHANGE_PERCENT) {
        // move label above guideline
        layoutParamsTextLabel.bottomToTop = mGuidelineTop.getId();
        layoutParamsTextLabel.topToTop = -1;
        layoutParamsTextLabel.bottomMargin = mLabelMargin;
        layoutParamsTextLabel.topMargin = 0;

    } else {
        // move label below guideline
        layoutParamsTextLabel.topToTop = mGuidelineTop.getId();
        layoutParamsTextLabel.bottomToTop = -1;
        layoutParamsTextLabel.bottomMargin = 0;
        layoutParamsTextLabel.topMargin = mLabelMargin;
    }
    mTextLabel.setLayoutParams(layoutParamsTextLabel);

    ConstraintLayout.LayoutParams layoutParamsGuideline = (ConstraintLayout.LayoutParams) mGuidelineTop.getLayoutParams();
    layoutParamsGuideline.guidePercent = item.getPercent();
    mGuidelineTop.setLayoutParams(layoutParamsGuideline);

}
 
开发者ID:DroidsOnRoids,项目名称:constraint-layout-charts,代码行数:25,代码来源:ChartsViewHolder.java

示例10: ViewHolderItem

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
public ViewHolderItem(View itemView) {
            super(itemView);

            itemView.setOnClickListener(this);

//            itemDescription = (TextView) itemView.findViewById(R.id.itemDescription);
            itemName = (TextView) itemView.findViewById(R.id.itemName);
            itemImage = (ImageView) itemView.findViewById(R.id.itemImage);
            priceRange = (TextView) itemView.findViewById(R.id.price_range);
            priceAverage = (TextView) itemView.findViewById(R.id.price_average);
            shopCount = (TextView) itemView.findViewById(R.id.shop_count);
            itemsListItem = (ConstraintLayout) itemView.findViewById(R.id.items_list_item);

            itemRating = (TextView) itemView.findViewById(R.id.item_rating);
            ratingCount = (TextView) itemView.findViewById(R.id.rating_count);

            itemsListItem.setOnClickListener(this);
            itemImage.setOnClickListener(this);
        }
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-End-User-Android-app,代码行数:20,代码来源:AdapterNewCarts.java

示例11: ViewHolder

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
public ViewHolder(View itemView) {
            super(itemView);

            itemView.setOnClickListener(this);

//            itemDescription = (TextView) itemView.findViewById(R.id.itemDescription);
            itemName = (TextView) itemView.findViewById(R.id.itemName);
            itemImage = (ImageView) itemView.findViewById(R.id.itemImage);
            priceRange = (TextView) itemView.findViewById(R.id.price_range);
            priceAverage = (TextView) itemView.findViewById(R.id.price_average);
            shopCount = (TextView) itemView.findViewById(R.id.shop_count);
            itemsListItem = (ConstraintLayout) itemView.findViewById(R.id.items_list_item);

            itemRating = (TextView) itemView.findViewById(R.id.item_rating);
            ratingCount = (TextView) itemView.findViewById(R.id.rating_count);

            itemsListItem.setOnClickListener(this);
            itemImage.setOnClickListener(this);
        }
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-End-User-Android-app,代码行数:20,代码来源:AdapterItemHorizontalScreen.java

示例12: onCreateViewHolder

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    ViewHolder viewHolder = null;
    Context context = parent.getContext();
    switch (viewType) {
        case TYPE_TOPIC:
            viewHolder = TopicViewHolder.makeHolder(parent, mContentListener, mNodeListener, mAvatarListener);
            break;
        case TYPE_COMMENT:
            final CommentView view = new CommentView(context);

            view.setLayoutParams(
                    new ConstraintLayout.LayoutParams(
                            ViewGroup.LayoutParams.MATCH_PARENT,
                            ViewGroup.LayoutParams.WRAP_CONTENT));
            viewHolder = new CommentViewHolder(view, mCommentListener);
    }

    return viewHolder;
}
 
开发者ID:CzBiX,项目名称:v2ex-android,代码行数:21,代码来源:CommentAdapter.java

示例13: onResume

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    if (getUserVisibleHint()) {
        if (getView() != null) {
            swipeRefreshLayout = getView().findViewById(R.id.swipe_refresh_layout);
        }
    }
    if (swipeRefreshLayout != null) {
        swipeRefreshLayout.setOnRefreshListener(this);
    }
    AppBarLayout appBar = getActivity().findViewById(R.id.appbar);
    if (appBar != null) {
        Guideline guideTopInfo = getView().findViewById(R.id.guideline);
        ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) guideTopInfo.getLayoutParams();
        params.guidePercent = .45f;
        guideTopInfo.setLayoutParams(params);
    }
    refreshHandler.post(refreshRunnable);
}
 
开发者ID:alvinhkh,项目名称:buseta,代码行数:21,代码来源:LwbStopListFragment.java

示例14: onCreateView

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater,
                         ViewGroup container, Bundle savedInstanceState) {
    // The last two arguments ensure LayoutParams are inflated
    // properly.

    View rootView = inflater.inflate(R.layout.fragment_greetings, container, false);
    ok = (BRButton) rootView.findViewById(R.id.ok);
    mainLayout = (ConstraintLayout) rootView.findViewById(R.id.signal_layout);
    background = (RelativeLayout) rootView.findViewById(R.id.layout);

    ok.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getActivity().onBackPressed();
        }
    });
    return rootView;
}
 
开发者ID:breadwallet,项目名称:breadwallet-android,代码行数:20,代码来源:FragmentGreetings.java

示例15: bind

import android.support.constraint.ConstraintLayout; //导入依赖的package包/类
@Override
public void bind(ConstraintLayout view)
{
    ButterKnife.bind(this, view);
    tvReleaseName.setText(releaseName);
    tvDatePosted.setText("Listed: " + dateFormatter.formatIsoDate(datePosted));
    lytListing.setOnClickListener(onClickListener);
}
 
开发者ID:jbmlaird,项目名称:DiscogsBrowser,代码行数:9,代码来源:ListingModel.java


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