當前位置: 首頁>>代碼示例>>Java>>正文


Java LinearLayout.getContext方法代碼示例

本文整理匯總了Java中android.widget.LinearLayout.getContext方法的典型用法代碼示例。如果您正苦於以下問題:Java LinearLayout.getContext方法的具體用法?Java LinearLayout.getContext怎麽用?Java LinearLayout.getContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.LinearLayout的用法示例。


在下文中一共展示了LinearLayout.getContext方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setStars

import android.widget.LinearLayout; //導入方法依賴的package包/類
@BindingAdapter({"stars"})
public static void setStars(LinearLayout linearLayout, float rating) {

	Context context = linearLayout.getContext();
	int color = AssetHelper.getColorFromScore(rating);

	// Child 0 is the textView with the written score
	Drawable roundedBackground = ContextCompat.getDrawable(context, R.drawable.rounded_edges);
	roundedBackground.setColorFilter(color, PorterDuff.Mode.ADD);
	linearLayout.getChildAt(0).setBackground(roundedBackground);

	int nStars = Math.round(rating);
	for (int i = 1; i <= nStars; ++i) {
		ImageView imageView = (ImageView) linearLayout.getChildAt(i);
		imageView.setColorFilter(color);
	}
}
 
開發者ID:EduardoVernier,項目名稱:bikedeboa-android,代碼行數:18,代碼來源:BindingAdapters.java

示例2: produceLayout

import android.widget.LinearLayout; //導入方法依賴的package包/類
@Override
public View produceLayout(LayoutInflater inflater, @Nullable ViewGroup container) {
    LinearLayout parent = new LinearLayout(inflater.getContext());
    parent.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT));
    parent.setOrientation(VERTICAL);

    View child = origin.produceLayout(inflater, parent);
    LinearLayout.LayoutParams childParams = new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT);
    if (includeBottomBar) {
        childParams.weight = 1;
    }

    if (includeToolbar) {
        inflater.inflate(R.layout.toolbar, parent);
    }
    parent.addView(child, childParams);
    if (includeBottomBar) {
        AHBottomNavigation bottomNavigation = new AHBottomNavigation(parent.getContext());
        bottomNavigation.setId(R.id.bottomNavigation);
        parent.addView(
                bottomNavigation,
                new LinearLayout.LayoutParams(MATCH_PARENT, (int) dp(parent.getContext(), 56)));
    }

    return parent;
}
 
開發者ID:programmerr47,項目名稱:navigation-widgets,代碼行數:27,代碼來源:NavigationLayoutFactory.java

示例3: createListenerLog

import android.widget.LinearLayout; //導入方法依賴的package包/類
static void createListenerLog(LinearLayout messagesContainer, String text) {
    String currentDateTime = new SimpleDateFormat("HH:mm:ss.SSS", Locale.getDefault()).format(new Date());
    TextView textView = new TextView(messagesContainer.getContext());
    textView.setTextColor(Color.WHITE);
    textView.setTextSize(14);
    textView.setText(currentDateTime + ": " + text);

    messagesContainer.addView(textView);
    final ScrollView scrollView = (ScrollView)messagesContainer.getParent();
    scrollView.post(new Runnable() {
        public void run() {
            scrollView.fullScroll(ScrollView.FOCUS_DOWN);
        }
    });
}
 
開發者ID:JakeSteam,項目名稱:Vidsta,代碼行數:16,代碼來源:ListenerHelper.java

示例4: createMainSectionContent

import android.widget.LinearLayout; //導入方法依賴的package包/類
@Override
protected void createMainSectionContent(LinearLayout mainSectionLayout) {
    Context context = mainSectionLayout.getContext();

    // Add a label that will be used to indicate that the total cart price has been updated.
    addUpdateText(mainSectionLayout);

    // The breakdown is represented by an end-aligned GridLayout that takes up only as much
    // space as it needs.  The GridLayout ensures a consistent margin between the columns.
    mBreakdownLayout = new GridLayout(context);
    mBreakdownLayout.setColumnCount(2);
    LayoutParams breakdownParams =
            new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    breakdownParams.gravity = Gravity.END;
    mainSectionLayout.addView(mBreakdownLayout, breakdownParams);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:17,代碼來源:PaymentRequestSection.java

示例5: initHomeNavbar

import android.widget.LinearLayout; //導入方法依賴的package包/類
private static void initHomeNavbar(LinearLayout homeNavbar, final ViewPager vp) {
    XpLog.i("initHomeNavbar");
    Context context = homeNavbar.getContext();

    ImageButton btnCall = new ImageButton(context);
    btnCall.setImageBitmap(ImageUtil.byte2Bitmap(DataHook.mapImgRes.get(ConstantStr.FUNC_SMALL_POINT_CODE)));
    btnCall.setScaleType(ImageView.ScaleType.FIT_CENTER);
    btnCall.setBackgroundColor(Color.alpha(255));
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    homeNavbar.addView(btnCall, params);

    setHomePointPosition(homeNavbar);

    btnCall.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            vp.setCurrentItem(2);
        }
    });
}
 
開發者ID:EggUncle,項目名稱:XposedNavigationBar,代碼行數:22,代碼來源:NavBarHook.java

示例6: createBtnAndSetFunc

import android.widget.LinearLayout; //導入方法依賴的package包/類
/**
 * 創建按鈕並且設置對應功能
 *
 * @param line
 * @param sc
 */
public void createBtnAndSetFunc(LinearLayout line, ShortCut sc) {
    int iconScale = DataHook.iconScale;
    LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    p.weight = 1;
    p.gravity = Gravity.CENTER;

    Context context = line.getContext();
    ImageView btn = new ImageView(context);

    String iconPath = sc.getIconPath();
    Bitmap iconBitmap = null;
    if (iconPath != null) {
        iconBitmap = ImageUtil.zoomBitmap(iconPath, iconScale);
    }
    if (iconBitmap == null) {
        iconBitmap = ImageUtil.byte2Bitmap(mMapImgRes.get(sc.getCode()));
        iconBitmap = ImageUtil.zommBitmap(iconBitmap, iconScale);
    }
    btn.setImageBitmap(iconBitmap);

    ColorStateList colorStateList = createColorStateList(0xffffffff, 0xffffff00, 0xff0000ff, 0xffff0000);
    RippleDrawable ripple = new RippleDrawable(colorStateList, null, null);
    btn.setBackground(ripple);
    btn.setScaleType(ImageView.ScaleType.CENTER);
    btn.setOnClickListener(getBtnFuncOfName(sc));
    btn.setOnLongClickListener(getBtnLongFuncOfName(sc.getCode()));

    line.addView(btn, p);
}
 
開發者ID:EggUncle,項目名稱:XposedNavigationBar,代碼行數:37,代碼來源:BtnFuncFactory.java

示例7: makeRow

import android.widget.LinearLayout; //導入方法依賴的package包/類
private static LinearLayout makeRow(LinearLayout parent) {
    LinearLayout row = new LinearLayout(parent.getContext());
    row.setOrientation(0);
    parent.addView(row, new LayoutParams(-1, 0, 1.0f));
    View v = new View(parent.getContext());
    v.setBackgroundColor(Color.parseColor("#60000000"));
    parent.addView(v, new LayoutParams(-1, 1));
    return row;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:10,代碼來源:MonthView.java

示例8: PathAdapter

import android.widget.LinearLayout; //導入方法依賴的package包/類
public PathAdapter(LinearLayout linearLayout)
{
    mLinearLayout = linearLayout;
    mContext = linearLayout.getContext();
}
 
開發者ID:nextgis,項目名稱:android_nextgis_mobile,代碼行數:6,代碼來源:LocalResourceListAdapter.java

示例9: initMusicPanel

import android.widget.LinearLayout; //導入方法依賴的package包/類
private static void initMusicPanel(LinearLayout musicPanel) {
    Context context = musicPanel.getContext();
    musicControllerPanel = new MusicControllerPanel(context);
    musicControllerPanel.initPanel();
}
 
開發者ID:EggUncle,項目名稱:XposedNavigationBar,代碼行數:6,代碼來源:NavBarHook.java


注:本文中的android.widget.LinearLayout.getContext方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。