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


Java ScrollView.setLayoutParams方法代码示例

本文整理汇总了Java中android.widget.ScrollView.setLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollView.setLayoutParams方法的具体用法?Java ScrollView.setLayoutParams怎么用?Java ScrollView.setLayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ScrollView的用法示例。


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

示例1: setMessage

import android.widget.ScrollView; //导入方法依赖的package包/类
public void setMessage(Spanned spanned) {
    ScrollView scrollView = new ScrollView(getContext());
    scrollView.setLayoutParams(new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.WRAP_CONTENT));
    TextView tvMessage = new TextView(getContext(), null,
            R.style.dialog_pinterest_text);
    tvMessage.setLayoutParams(new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.MATCH_PARENT,
            FrameLayout.LayoutParams.WRAP_CONTENT));
    tvMessage.setPadding(contentPadding, contentPadding, contentPadding,
            contentPadding);
    tvMessage.setLineSpacing(0.0F, 1.3F);
    tvMessage.setText(spanned);
    tvMessage.setTextColor(getContext().getResources().getColor(
            R.color.black));

    ScrollView.LayoutParams lp = new ScrollView.LayoutParams(
            ScrollView.LayoutParams.MATCH_PARENT,
            ScrollView.LayoutParams.WRAP_CONTENT);
    scrollView.addView(tvMessage, lp);
    setContent(scrollView, 0);
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:24,代码来源:CommonDialog.java

示例2: inflateViews

import android.widget.ScrollView; //导入方法依赖的package包/类
public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);

    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);

    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);

    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);

    mScrollView.addView(mLogView);
    return mScrollView;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:LogFragment.java

示例3: onCreateContent

import android.widget.ScrollView; //导入方法依赖的package包/类
@Override
protected void onCreateContent(QMUIDialog dialog, ViewGroup parent) {
    mScrollerView = new ScrollView(mContext);
    mScrollerView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, onGetScrollHeight()));
    mScrollerView.addView(onBuildContent(dialog, mScrollerView));
    parent.addView(mScrollerView);
}
 
开发者ID:coopese,项目名称:qmui,代码行数:8,代码来源:QMUIDialog.java

示例4: init

import android.widget.ScrollView; //导入方法依赖的package包/类
private void init() {

        sc = new ScrollView(getContext());
        sc.setLayoutParams(new FrameLayout.LayoutParams(Ui.cd.DPW+ Ui.cd.DPW, Ui.cd.DPH));
        sc.setBackgroundColor(0x00FFFFFF);
        addView(sc);

        main = new FMlyt(getContext(), Ui.cd.DPW, Ui.cd.DPH);
        main.setBackgroundColor(0x00000000);
        sc.addView(main,new ScrollView.LayoutParams(Ui.cd.DPW, Ui.cd.DPH));

        FMView back = new FMView(getContext(), Ui.cd.DPW, Ui.cd.DPH+ Ui.cd.DPH);
        back.setLayerType(LAYER_TYPE_SOFTWARE,null);
        main.addView(back);

        ShapeView titleback = titleBackground.getFMview(getContext(),false);
        titleback.setSize(Ui.cd.DPW, Ui.cd.getHt(60));
        main.addView(titleback);



        FMText titleText = textImg.getFMText(getContext() ,"AUDIO EQULIZERS", Ui.cd.getHt(18));
        titleText.img.setColor(0x66FFFFFF);
        titleText.InCenter(Ui.cd.DPW, Ui.cd.getHt(60));
        main.addView(titleText);

        int top = Ui.cd.getHt(60);
        top = bassFn(top);
        top = verchulizerFn(top);
        top = eqlizerFn(top);
        back.setSize(back.width,top);
    }
 
开发者ID:KishanV,项目名称:Android-Music-Player,代码行数:33,代码来源:eqlizerMain.java

示例5: createLayout

import android.widget.ScrollView; //导入方法依赖的package包/类
private void createLayout(int width) {
    float scale = IceScreenUtils.densityScale(getApplicationContext());
    int margin = 16 * Math.round(scale);

    LinearLayout.LayoutParams baseParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    LinearLayout.LayoutParams containerParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    LinearLayout.LayoutParams imageParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1f);

    ScrollView baseScroller = new ScrollView(this);
    baseScroller.setLayoutParams(baseParams);
    baseScroller.setBackgroundColor(0xffffffff);
    setContentView(baseScroller);
    baseScroller.setVisibility(View.VISIBLE);

    // display width hack
    Rect windowRect = new Rect();
    baseScroller.getWindowVisibleDisplayFrame(windowRect);
    int windowWidth = windowRect.right - windowRect.left;

    LinearLayout baseLayout = new LinearLayout(this);
    baseLayout.setOrientation(LinearLayout.VERTICAL);
    baseLayout.setLayoutParams(layoutParams);
    baseLayout.setPadding(margin, margin, 0, 0);
    baseScroller.addView(baseLayout);

    String[] wallpapers = getResources().getStringArray(R.array.wallpapers);
    for (int i = 0; i < wallpapers.length; i++) {
        if ((i % width) == 0) {
            layoutList.add((i / width), new LinearLayout(this));
            layoutList.get(i / width).setOrientation(LinearLayout.HORIZONTAL);
            layoutList.get(i / width).setGravity(Gravity.LEFT);
            layoutList.get(i / width).setLayoutParams(containerParams);

            baseLayout.addView(layoutList.get(i / width));
        }
        imageList.add(i, new ImageView(this));
        imageList.get(i).setLayoutParams(imageParams);
        imageList.get(i).setScaleType(ImageView.ScaleType.FIT_XY);
        imageList.get(i).setPadding(0, 0, margin, margin);
        IceImageUtils.bitmapLoadAsync(imageList.get(i), getApplicationContext(), getApplicationContext().getResources(), wallpapers[i], (windowWidth / width) - (margin * width + margin) / width, (windowWidth / width) - (margin * width + margin) / width);
        imageList.get(i).setAdjustViewBounds(true);

        final Integer tempId = getResources().getIdentifier(wallpapers[i], "drawable", getPackageName());
        imageList.get(i).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                wallpaperView(tempId);
            }
        });

        layoutList.get(i / width).addView(imageList.get(i));
    }
}
 
开发者ID:dkanada,项目名称:frost,代码行数:55,代码来源:WallpaperActivity.java

示例6: createLayout

import android.widget.ScrollView; //导入方法依赖的package包/类
private void createLayout(int width) {
    float scale = IceScreenUtils.densityScale(getApplicationContext());
    int margin = 16 * Math.round(scale);

    LinearLayout.LayoutParams baseParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    LinearLayout.LayoutParams containerParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    LinearLayout.LayoutParams imageParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1f);

    ScrollView baseScroller = new ScrollView(this);
    baseScroller.setLayoutParams(baseParams);
    baseScroller.setBackgroundColor(0xff000000);
    setContentView(baseScroller);
    baseScroller.setVisibility(View.VISIBLE);

    // display width hack
    Rect windowRect = new Rect();
    baseScroller.getWindowVisibleDisplayFrame(windowRect);
    int windowWidth = windowRect.right - windowRect.left;

    LinearLayout baseLayout = new LinearLayout(this);
    baseLayout.setOrientation(LinearLayout.VERTICAL);
    baseLayout.setLayoutParams(layoutParams);
    baseLayout.setPadding(margin, margin, 0, 0);
    baseScroller.addView(baseLayout);

    String[] images = getResources().getStringArray(R.array.icon_pack);
    for (int i = 0; i < images.length; i++) {
        if ((i % width) == 0) {
            layoutList.add((i / width), new LinearLayout(this));
            layoutList.get(i / width).setOrientation(LinearLayout.HORIZONTAL);
            layoutList.get(i / width).setGravity(Gravity.LEFT);
            layoutList.get(i / width).setLayoutParams(containerParams);

            baseLayout.addView(layoutList.get(i / width));
        }
        imageList.add(i, new ImageView(this));
        imageList.get(i).setLayoutParams(imageParams);
        imageList.get(i).setScaleType(ImageView.ScaleType.FIT_XY);
        imageList.get(i).setPadding(0, 0, margin, margin);
        IceImageUtils.bitmapLoadAsync(imageList.get(i), getApplicationContext(), getApplicationContext().getResources(), "nodpi_" + images[i], (windowWidth / width) - (margin * width + margin) / width, (windowWidth / width) - (margin * width + margin) / width);
        imageList.get(i).setAdjustViewBounds(true);
        layoutList.get(i / width).addView(imageList.get(i));
    }
}
 
开发者ID:dkanada,项目名称:frost,代码行数:46,代码来源:IconActivity.java

示例7: createComponentView

import android.widget.ScrollView; //导入方法依赖的package包/类
public  View createComponentView(Context context, ViewGroup parent, XViewBody yiew) {
    ScrollView view = new ScrollView(context);

    ViewGroup.LayoutParams params = Utils.createLayoutParams(parent, yiew);
    view.setLayoutParams(params);

    view.setVerticalFadingEdgeEnabled(false);
    view.setOverScrollMode(ScrollView.OVER_SCROLL_NEVER);
    view.setFadingEdgeLength(0);
    ViewProcess.applyView(view, yiew);
    LayoutProcess.applyaLayout(view, params, yiew);


    view.setVerticalFadingEdgeEnabled(false);
    view.setOverScrollMode(ScrollView.OVER_SCROLL_NEVER);
    view.setFadingEdgeLength(0);

    ViewGroupProcess.applyViewGroup(view,yiew);

    return view;

}
 
开发者ID:Aarthas,项目名称:android_Json2view,代码行数:23,代码来源:ScrollViewProcess.java


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