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