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


Java LinearLayout.draw方法代码示例

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


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

示例1: getBitmapFromView

import android.widget.LinearLayout; //导入方法依赖的package包/类
public Bitmap getBitmapFromView(String title, int dotBg) {

        LinearLayout llmarker = (LinearLayout) findViewById(R.id.ll_marker);
        TextView markerImageView = (TextView) findViewById(R.id.tv_title);
        markerImageView.setText(title);
        View dot = (View) findViewById(R.id.dot_marker);
        dot.setBackgroundResource(dotBg);

        llmarker.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
        Bitmap bitmap = Bitmap.createBitmap(llmarker.getMeasuredWidth(), llmarker.getMeasuredHeight(),
                Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        llmarker.layout(0, 0, llmarker.getMeasuredWidth(), llmarker.getMeasuredHeight());
        llmarker.draw(canvas);
        return bitmap;
    }
 
开发者ID:ahmadnurhidayat,项目名称:Taxi-App-Android-XML,代码行数:17,代码来源:MyTrip.java

示例2: getBitmapByView

import android.widget.LinearLayout; //导入方法依赖的package包/类
public static Bitmap getBitmapByView(LinearLayout linearLayout) {
    int h = 0;
    int i = 0;
    while (i < linearLayout.getChildCount()) {
        try {
            if (linearLayout.getChildAt(i).getVisibility() == 0) {
                h += linearLayout.getChildAt(i).getHeight();
            }
            i++;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    Bitmap bitmap = Bitmap.createBitmap(linearLayout.getWidth(), h, Config.ARGB_8888);
    linearLayout.draw(new Canvas(bitmap));
    return bitmap;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:BitmapUtil.java

示例3: write

import android.widget.LinearLayout; //导入方法依赖的package包/类
public void write(FormulaListView formulaListView, Bitmap.CompressFormat format) throws Exception
{
    final LinearLayout f = formulaListView.getList();
    Bitmap bitmap = null;
    try
    {
        bitmap = Bitmap.createBitmap(f.getMeasuredWidth(), f.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
        final Canvas canvas = new Canvas(bitmap);
        f.setBackgroundColor(CompatUtils.getThemeColorAttr(f.getContext(), android.R.attr.windowBackground));
        f.draw(canvas);
    }
    catch (OutOfMemoryError e)
    {
        throw new Exception(e.getLocalizedMessage());
    }
    finally
    {
        f.setBackgroundResource(android.R.color.transparent);
    }
    bitmap.compress(format, 100, stream);
    stream.flush();
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:23,代码来源:ExportToImage.java


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