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


Java LinearLayout.setWeightSum方法代码示例

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


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

示例1: setCheckBoxName

import android.widget.LinearLayout; //导入方法依赖的package包/类
public BaseDialog setCheckBoxName(List<String> list) {
        if (middleLayout.getChildCount() > 0) {
                middleLayout.removeAllViews();
        }
        for (String title :
                list) {
                TextView textView = new TextView(getContext());
                textView.setGravity(Gravity.START);
                LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
                layoutParams.weight = 1;
                textView.setLayoutParams(layoutParams);
                textView.setText(title);
                final CheckBox checkBox = new CheckBox(getContext());
                checkBox.setGravity(Gravity.END);
                LinearLayout.LayoutParams checkBoxLayout = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
                checkBoxLayout.weight = 1;
                checkBox.setLayoutParams(checkBoxLayout);
                LinearLayout linearLayout = new LinearLayout(getContext());
                LinearLayout.LayoutParams linearLayoutParam = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
                linearLayout.setGravity(Gravity.CENTER_VERTICAL);
                linearLayout.setWeightSum(2);
                linearLayout.setLayoutParams(linearLayoutParam);
                linearLayout.addView(textView);
                linearLayout.addView(checkBox);
                middleLayout.addView(linearLayout);
        }
        return this;
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:29,代码来源:BaseDialog.java

示例2: PRow

import android.widget.LinearLayout; //导入方法依赖的package包/类
public PRow(Context c, LinearLayout cardLl, int n) {
    this.n = n;
    float t = 100f;
    float tt = t / n;

    ll = new LinearLayout(c);
    ll.setOrientation(LinearLayout.HORIZONTAL);
    ll.setWeightSum(t);
    cardLl.addView(ll);

    lParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, tt);
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:13,代码来源:PRow.java

示例3: initHorizontalView

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void initHorizontalView(Context context) {
    removeAllViews();
    setOrientation(VERTICAL);
    tabGroup = new LinearLayout(context);
    tabGroup.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    tabGroup.setWeightSum(tabCount);
    tabGroup.setOrientation(HORIZONTAL);
    addView(tabGroup);

    TabView tab = addTab(tabTextHint, true);
    tabGroup.addView(tab);
    tabList = new ArrayList<>();
    tabList.add(tab);
    for (int i = 1; i < tabCount; i++) {
        TabView nullTab = addTab("", false);
        nullTab.setIndex(i);
        tabGroup.addView(nullTab);
        tabList.add(nullTab);
    }

    indicatorView = new IndicatorView(context, tabCount);
    indicatorView.setBgColor(indicatorColor);
    indicatorView.setTabOrientation(HORIZONTAL);
    indicatorView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 6));
    addView(indicatorView);

    divisionLine = new View(context);
    divisionLine.setLayoutParams(new LayoutParams(
            LayoutParams.MATCH_PARENT, 2));
    divisionLine.setBackgroundColor(context.getResources().getColor(R.color.gray_line));
    addView(divisionLine);

    recyclerView = new RecyclerView(context);
    recyclerView.setLayoutManager(manager);
    if (manager instanceof GridLayoutManager){
        recyclerView.addItemDecoration(new SpaceItemDecoration(space));
    }
    LayoutParams layoutParams=new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParams.setMargins(10,10,10,0);
    recyclerView.setLayoutParams(layoutParams);
    addView(recyclerView);


}
 
开发者ID:yeshuwei,项目名称:MultipleS,代码行数:45,代码来源:MultipleSelector.java

示例4: initVerticalView

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void initVerticalView(Context context) {
    removeAllViews();
    setOrientation(HORIZONTAL);
    tabGroup = new LinearLayout(context);
    tabGroup.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    tabGroup.setOrientation(VERTICAL);
    tabGroup.setWeightSum(tabCount);
    addView(tabGroup);

    TabView tab = addTab(tabTextHint, true);
    tabGroup.addView(tab);
    tabList = new ArrayList<>();
    tabList.add(tab);
    for (int i = 1; i < tabCount; i++) {
        TabView nullTab = addTab("", false);
        tabList.add(nullTab);
        tabGroup.addView(nullTab);
        nullTab.setIndex(i);
    }

    indicatorView = new IndicatorView(context, tabCount);
    indicatorView.setBgColor(indicatorColor);
    indicatorView.setTabOrientation(VERTICAL);
    indicatorView.setLayoutParams(new LayoutParams(6, ViewGroup.LayoutParams.MATCH_PARENT));
    addView(indicatorView);

    divisionLine = new View(context);
    divisionLine.setLayoutParams(new LayoutParams(
            2, LayoutParams.MATCH_PARENT));
    divisionLine.setBackgroundColor(context.getResources().getColor(R.color.gray_line));
    addView(divisionLine);

    recyclerView = new RecyclerView(context);
    recyclerView.setLayoutManager(manager);
    if (manager instanceof GridLayoutManager){
        recyclerView.addItemDecoration(new SpaceItemDecoration(space));
    }
    LayoutParams layoutParams=new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParams.setMargins(10,10,10,0);
    recyclerView.setLayoutParams(layoutParams);
    addView(recyclerView);
}
 
开发者ID:yeshuwei,项目名称:MultipleS,代码行数:43,代码来源:MultipleSelector.java


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