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


Java LinearLayout.setLayoutTransition方法代码示例

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


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

示例1: initHorizontalChart

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void initHorizontalChart() {
    horizontalLinearParent = new LinearLayout(context);
    horizontalLinearParent.setOrientation(LinearLayout.VERTICAL);
    horizontalLinearParent.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    horizontalLinearParent.setGravity(Gravity.LEFT | Gravity.START);
    if (isShowAnimation) {
        horizontalLinearParent.setLayoutTransition(new LayoutTransition());
    }
    this.addView(horizontalLinearParent);
}
 
开发者ID:ITheBK,项目名称:BarChart,代码行数:12,代码来源:BarChart.java

示例2: initVerticalChart

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void initVerticalChart() {
    verticalLinearParent = new LinearLayout(context);
    verticalLinearParent.setOrientation(LinearLayout.HORIZONTAL);
    verticalLinearParent.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    verticalLinearParent.setGravity(Gravity.BOTTOM);
    if (isShowAnimation) {
        verticalLinearParent.setLayoutTransition(new LayoutTransition());
    }
    this.addView(verticalLinearParent);
}
 
开发者ID:ITheBK,项目名称:BarChart,代码行数:12,代码来源:BarChart.java

示例3: letItGo

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void letItGo() {
    removeAllViews();
    final LinearLayout dateTitleView = new LinearLayout(getContext());
    dateTitleView.setLayoutParams(rowParams);
    dateTitleView.setOrientation(HORIZONTAL);
    dateTitleView.setLayoutTransition(transition);
    dateTitleView.removeAllViews();

    final LinearLayout iconView = new LinearLayout(getContext());
    iconView.setLayoutParams(rowParams);
    iconView.setOrientation(HORIZONTAL);
    iconView.setLayoutTransition(transition);
    iconView.removeAllViews();

    final LinearLayout weatherStrView = new LinearLayout(getContext());
    weatherStrView.setLayoutParams(rowParams);
    weatherStrView.setOrientation(HORIZONTAL);
    weatherStrView.setLayoutTransition(transition);
    weatherStrView.removeAllViews();

    List<Integer> minTemp = new ArrayList<>();
    List<Integer> maxTemp = new ArrayList<>();
    for (int i = 0; i < dailyForecastList.size(); i++) {
        final TextView tvDate = new TextView(getContext());
        tvDate.setGravity(Gravity.CENTER);
        tvDate.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
        tvDate.setTextColor(getResources().getColor(R.color.colorTextDark));
        tvDate.setVisibility(INVISIBLE);
        final TextView tvWeather = new TextView((getContext()));
        tvWeather.setGravity(Gravity.CENTER);
        tvWeather.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
        tvWeather.setTextColor(getResources().getColor(R.color.colorTextDark));
        tvWeather.setVisibility(INVISIBLE);
        final ImageView ivIcon = new ImageView(getContext());
        ivIcon.setAdjustViewBounds(true);
        ivIcon.setScaleType(ImageView.ScaleType.FIT_CENTER);
        int padding = SizeUtils.dp2px(getContext(), 10);
        int width = SizeUtils.getScreenWidth(getContext()) / dailyForecastList.size();
        LayoutParams ivParam = new LayoutParams(width, width);
        ivParam.weight = 1;
        ivIcon.setLayoutParams(ivParam);
        ivIcon.setPadding(padding, padding, padding, padding);
        ivIcon.setVisibility(INVISIBLE);
        tvDate.setText(dailyForecastList.get(i).getDate());
        tvWeather.setText(dailyForecastList.get(i).getTxt());
        WeatherUtil.getInstance().getWeatherDict(dailyForecastList.get(i).getCode()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SimpleSubscriber<WeatherBean>() {
            @Override
            public void onNext(WeatherBean weatherBean) {
                Glide.with(getContext()).load(weatherBean.getIcon()).diskCacheStrategy(DiskCacheStrategy.ALL).into(ivIcon);
            }
        });
        minTemp.add(Integer.valueOf(dailyForecastList.get(i).getMinTemp()));
        maxTemp.add(Integer.valueOf(dailyForecastList.get(i).getMaxTemp()));
        weatherStrView.addView(tvWeather, cellParams);
        dateTitleView.addView(tvDate, cellParams);
        iconView.addView(ivIcon);
        this.postDelayed(new Runnable() {
            @Override
            public void run() {
                tvDate.setVisibility(VISIBLE);
                tvWeather.setVisibility(VISIBLE);
                ivIcon.setVisibility(VISIBLE);
            }
        }, 200 * i);
    }
    addView(dateTitleView);
    addView(iconView);
    addView(weatherStrView);
    final ChartView chartView = new ChartView(getContext());
    chartView.setData(minTemp, maxTemp);
    chartView.setPadding(0, SizeUtils.dp2px(getContext(), 16), 0, SizeUtils.dp2px(getContext(), 16));
    addView(chartView, chartParams);
}
 
开发者ID:li-yu,项目名称:FakeWeather,代码行数:74,代码来源:WeatherChartView.java


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