當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。