当前位置: 首页>>代码示例>>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;未经允许,请勿转载。