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


Java PercentRelativeLayout类代码示例

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


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

示例1: ViewHolder

import android.support.percent.PercentRelativeLayout; //导入依赖的package包/类
public ViewHolder(View view) {
    super(view);
    earnLayout = (PercentRelativeLayout) view.findViewById(R.id.earn_left_layout);
    costLayout = (PercentRelativeLayout) view.findViewById(R.id.cost_right_layout);
    dateBar    = (RelativeLayout) view.findViewById(R.id.date_bar);

    itemImageEarn = (ImageView) view.findViewById(R.id.earn_item_img_main);
    itemImageCost = (ImageView) view.findViewById(R.id.cost_item_img_main);
    itemNameEarn  = (TextView ) view.findViewById(R.id.earn_item_name_main);
    itemNameCost  = (TextView ) view.findViewById(R.id.cost_item_name_main);
    itemMoneyEarn = (TextView ) view.findViewById(R.id.earn_item_money_main);
    itemMoneyCost = (TextView ) view.findViewById(R.id.cost_item_money_main);
    itemDspEarn   = (TextView ) view.findViewById(R.id.earn_item_decription);
    itemDspCost   = (TextView ) view.findViewById(R.id.cost_item_decription);
    itemDate      = (TextView ) view.findViewById(R.id.iotem_date);
}
 
开发者ID:yuukidach,项目名称:Ucount,代码行数:17,代码来源:IOItemAdapter.java

示例2: addToBoard

import android.support.percent.PercentRelativeLayout; //导入依赖的package包/类
public void addToBoard(Stickerable sticker) {
    RelativeLayout.LayoutParams layoutParams = new PercentRelativeLayout.LayoutParams(StickerAttacherActivity.this, null);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);

    float boardWidth = mBoard.getMeasuredWidth();
    float boardHeight = mBoard.getMeasuredHeight();

    float widthRatio = sticker.getRelativeWidthRatio((int) smingWidth);
    float heightRatio = sticker.getRelativeHeightRatio((int) smingHeight);

    while (widthRatio > 0.6f || heightRatio > 0.6f) {
        widthRatio *= 0.8f;
        heightRatio *= 0.8f;
    }

    int stickerWidth = (int) (boardWidth * widthRatio);
    int stickerHeight = (int) (boardHeight * heightRatio);

    layoutParams.width = stickerWidth;
    layoutParams.height = stickerHeight;

    mBoard.addView((View) sticker, layoutParams);
}
 
开发者ID:monthlypub,项目名称:SmingZZick_App,代码行数:24,代码来源:StickerAttacherActivity.java

示例3: onCreateViewHolder

import android.support.percent.PercentRelativeLayout; //导入依赖的package包/类
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext())
            .inflate(mCardLayout, parent, false);
    ViewHolder holder = new ViewHolder(view);
    holder.imagePager.setRefreshLayout(mRefreshLayout);
    holder.imagePager.setAdapter(new ImageAdapter());
    holder.imageIndicator.setViewPager(holder.imagePager);
    holder.imagePager.getAdapter().registerDataSetObserver(holder.imageIndicator.getDataSetObserver());
    if (mHeaderCard) {
        holder.imagePager.enableSwipe(true);
        PercentRelativeLayout.LayoutParams footerParams = (PercentRelativeLayout.LayoutParams) holder.cardFooter.getLayoutParams();
        if (footerParams != null) {
            PercentLayoutHelper.PercentLayoutInfo info = footerParams.getPercentLayoutInfo();
            info.heightPercent = parent.getContext().getResources().getFraction(R.fraction.heightPercentPlaceFooterInHeader, 1, 1);
            holder.cardFooter.requestLayout();
        }
    }
    if (mNearbyCard) {
        holder.cardView.getLayoutParams().height = mNearbyCardHeight;
    }
    return holder;
}
 
开发者ID:Turistforeningen,项目名称:SjekkUT,代码行数:24,代码来源:PlaceAdapter.java

示例4: onCreate

import android.support.percent.PercentRelativeLayout; //导入依赖的package包/类
/**
 * Initializes the UI and creates the detector pipeline.
 */
@Override
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.ocr_capture);
    mPreview = (CameraSourcePreview) findViewById(R.id.preview);
    mGraphicOverlay = (GraphicOverlay<OcrGraphic>) findViewById(R.id.graphicOverlay);
    shoot = (Button) findViewById(R.id.button_shutter);
    shoot.setEnabled(false);
    textView1 = (TextView) findViewById(R.id.text_view_scan);
    mImageViewClear = (ImageView) findViewById(R.id.image_view_clear);
    mImageViewFlash = (ImageView) findViewById(R.id.image_view_flash);
    rectangleIfeFront = (PercentRelativeLayout) findViewById(R.id.rl_ife_view_front);
    rectangleIfeBack = (PercentRelativeLayout) findViewById(R.id.rl_ife_view_back);
    rectangleIneBack = (PercentRelativeLayout) findViewById(R.id.rl_ine_view_back);
    detectShape = (PercentRelativeLayout) findViewById(R.id.rl_view_detect);

    // Set good defaults for capturing text.
    boolean autoFocus = true;
    boolean useFlash = false;

    // Check for the camera permission before accessing the camera.  If the
    // permission is not granted yet, request permission.
    int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
    int rc2 = ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);
    if (rc == PackageManager.PERMISSION_GRANTED && rc2 == PackageManager.PERMISSION_GRANTED) {
        createCameraSource(autoFocus, useFlash);
    } else {
        requestCameraPermission();
    }
}
 
开发者ID:BrandonVargas,项目名称:AndroidOCRFforID,代码行数:37,代码来源:OcrIdActivity.java

示例5: onBindViewHolder

import android.support.percent.PercentRelativeLayout; //导入依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    SDFile _temp_data = _data.get_children().get(position);
    //设置文件大小比例条
    float _percent = (float) NumberUtil.div(_temp_data.get_sizePercent(), 100, 2);
    PercentRelativeLayout.LayoutParams _params = new PercentRelativeLayout.LayoutParams(0, 0);
    _params.getPercentLayoutInfo().widthPercent = _percent;
    holder._view_percent.setLayoutParams(_params);
    int _color = (int) _evaluator.evaluate(_percent, COLOR_START, COLOR_END);
    holder._view_percent.setBackgroundColor(_color);
    //设置清理标志
    if (_temp_data.isRubbish())
        holder._image_rubbish.setVisibility(ImageView.VISIBLE);
    else
        holder._image_rubbish.setVisibility(ImageView.GONE);
    //设置类型图标
    if (_temp_data.isDirectory())
        holder._image_type.setImageResource(R.drawable.icon_directory);
    else
        holder._image_type.setImageResource(R.drawable.icon_file);
    //设置基本信息
    holder._text_name.setText(_temp_data.get_name());
    String _str_size;
    if (_temp_data.isDirectory())
        _str_size = holder._view_click.getContext().getString(R.string.state_directory_size, Formatter.formatFileSize(holder._view_click.getContext(), _temp_data.get_size()), _temp_data.get_fileCount());
    else
        _str_size = Formatter.formatFileSize(holder._view_click.getContext(), _temp_data.get_size());
    holder._text_size.setText(_str_size);
    holder._view_click.setTag(new String[]{ACTION_CLICK_ITEM, String.valueOf(position)});
}
 
开发者ID:bonepeople,项目名称:SDCardCleaner,代码行数:31,代码来源:FileListAdapter.java

示例6: updateConcentration

import android.support.percent.PercentRelativeLayout; //导入依赖的package包/类
@Subscribe
public void updateConcentration(final MuseHandler.FocusReading reading) {
    getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            float concentration = (float) reading.getFocus();
            int[] border = mColorMap.map(0.3);

            final View concentrationBar = getView().findViewById(R.id.concentrationBar);
            final View concentrationBorder = getView().findViewById(R.id.concentrationBorder);
            concentrationBorder.setBackgroundColor(Color.rgb(border[0], border[1], border[2]));

            final PercentRelativeLayout.LayoutParams params = (PercentRelativeLayout.LayoutParams) concentrationBar.getLayoutParams();
            params.getPercentLayoutInfo().heightPercent = concentration;
            concentrationBar.requestLayout();

            double score = 0;
            if (mPlayerScore.isPresent()) {
                mPlayerScore.get().addScore(reading.getFocus());
                score = mPlayerScore.get().getScore();
            }
            mAccumulatedScore.setText(String.format("%.3f", score));
        }
    });
    if (mPlayerScore.isPresent()) {
        mPlayerScore.get().addScore(reading.getFocus());
    }
}
 
开发者ID:neuralcubes,项目名称:musephero,代码行数:29,代码来源:ControlFragment.java

示例7: onCreateView

import android.support.percent.PercentRelativeLayout; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_expense, container, false);
    rbExpense = (RadioButton) view.findViewById(R.id.rb_expense);
    rbIncome = (RadioButton) view.findViewById(R.id.rb_income);
    rcvView = (RecyclerView) view.findViewById(R.id.rcv_view);
    scrollView = (MySrollView) view.findViewById(R.id.scroll);

    ivTitleIcon = (ImageView) view.findViewById(R.id.iv_title_icon);
    tvTitleText = (TextView) view.findViewById(tv_title_text);
    tvAccountNum = (TextView) view.findViewById(R.id.tv_account_num);

    llBottom = (LinearLayout) view.findViewById(R.id.ll_bottom);
    moneyText = (TextView) view.findViewById(R.id.tv_account_num);
    moneyWindow = (LinearLayout) view.findViewById(R.id.have_chosen);
    plInput = (PercentRelativeLayout) view.findViewById(R.id.input_board);
    llSidebar = (LinearLayout) view.findViewById(R.id.calculator_sidebar);
    view.findViewById(R.id.one).setOnClickListener(this);
    view.findViewById(R.id.two).setOnClickListener(this);
    view.findViewById(R.id.three).setOnClickListener(this);
    view.findViewById(R.id.four).setOnClickListener(this);
    view.findViewById(R.id.five).setOnClickListener(this);
    view.findViewById(R.id.six).setOnClickListener(this);
    view.findViewById(R.id.seven).setOnClickListener(this);
    view.findViewById(R.id.eight).setOnClickListener(this);
    view.findViewById(R.id.nine).setOnClickListener(this);
    view.findViewById(R.id.zero).setOnClickListener(this);
    view.findViewById(R.id.clear).setOnClickListener(this);
    view.findViewById(R.id.dot).setOnClickListener(this);

    view.findViewById(R.id.add_finish).setOnClickListener(this);

    etDes = (EditText) view.findViewById(R.id.et_des);
    llBanner = (LinearLayout) view.findViewById(R.id.calculator_banner);
    rbExpense.setOnClickListener(this);
    rbIncome.setOnClickListener(this);
    GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 4);
    gridLayoutManager.setOrientation(GridLayoutManager.VERTICAL);
    rcvView.setLayoutManager(gridLayoutManager);
    initData();
    return view;
}
 
开发者ID:ITBlackDog,项目名称:XiaoHuaCharge,代码行数:44,代码来源:AddChargeFragment.java

示例8: setupFABs

import android.support.percent.PercentRelativeLayout; //导入依赖的package包/类
void setupFABs() {
    fabContainer.setTag(R.id.view_tag_flags, FLAG_HIDE | FLAG_ENABLE);
    fabContainer.setTag(R.id.view_tag_animator_reveal, new Runnable() {
        @Override
        public void run() {
            animateFABActions(false).start();
        }
    });
    fabContainer.setTag(R.id.view_tag_animator_hide, new Runnable() {
        @Override
        public void run() {
            animateFABActions(true).start();
        }
    });

    int navBarHeight = UIUtils.getNavBarHeight(this);
    if (navBarHeight > 0) {
        float navBarHeightPercentage = (float) navBarHeight / (float) UIUtils.getRealScreenSize().y;
        View fabAddWrapper = findById(this, R.id.fl_lwq_fab_reveal);
        PercentRelativeLayout.LayoutParams layoutParams =
                (PercentRelativeLayout.LayoutParams) fabAddWrapper.getLayoutParams();
        layoutParams.getPercentLayoutInfo().bottomMarginPercent += navBarHeightPercentage;
        fabAddWrapper.requestLayout();
    }

    fabAdd.setVisibility(View.GONE);
    fabAdd.setTag(R.id.view_tag_flags, FLAG_HIDE | FLAG_DISABLE | FLAG_NO_ROTATE);
    fabAdd.setTag(R.id.view_tag_animator_reveal, new Runnable() {
        @Override
        public void run() {
            animateFAB(fabAdd, false).start();
        }
    });
    fabAdd.setTag(R.id.view_tag_animator_hide, new Runnable() {
        @Override
        public void run() {
            animateFAB(fabAdd, true).start();
        }
    });
    fabAdd.setTag(R.id.view_tag_animator_rotate, new Runnable() {
        @Override
        public void run() {
            animateFABRotation(true).start();
        }
    });
    fabAdd.setTag(R.id.view_tag_animator_unrotate, new Runnable() {
        @Override
        public void run() {
            animateFABRotation(false).start();
        }
    });

    fabBackground.setVisibility(View.GONE);

    fabCreate.setAlpha(0f);
    fabCreate.setVisibility(View.GONE);

    fabSearch.setAlpha(0f);
    fabSearch.setVisibility(View.GONE);

    animateFAB(fabAdd, false).start();
}
 
开发者ID:stanidesis,项目名称:quotograph,代码行数:63,代码来源:LWQSettingsActivity.java


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