android.appwidget.AppWidgetHostView.setLayoutParams()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中android.appwidget.AppWidgetHostView.setLayoutParams()方法的一些代码示例,展示了AppWidgetHostView.setLayoutParams()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AppWidgetHostView.setLayoutParams()方法的具体详情如下:
包路径:android.appwidget.AppWidgetHostView
类名称:AppWidgetHostView
方法名:setLayoutParams

AppWidgetHostView.setLayoutParams介绍

暂无

代码示例

代码示例来源:origin: fookwood/Launcher3

@Override
  public void run() {
    if (mWidgetLoadingId == -1) {
      return;
    }
    AppWidgetHostView hostView = mLauncher.getAppWidgetHost().createView(
        (Context) mLauncher, mWidgetLoadingId, pInfo);
    mInfo.boundWidget = hostView;
    // We used up the widget Id in binding the above view.
    mWidgetLoadingId = -1;
    hostView.setVisibility(View.INVISIBLE);
    int[] unScaledSize = mLauncher.getWorkspace().estimateItemSize(mInfo, false);
    // We want the first widget layout to be the correct size. This will be important
    // for width size reporting to the AppWidgetManager.
    DragLayer.LayoutParams lp = new DragLayer.LayoutParams(unScaledSize[0],
        unScaledSize[1]);
    lp.x = lp.y = 0;
    lp.customPosition = true;
    hostView.setLayoutParams(lp);
    mLauncher.getDragLayer().addView(hostView);
    mView.setTag(mInfo);
  }
};

代码示例来源:origin: enricocid/LaunchEnr

@Override
  public void run() {
    if (mWidgetLoadingId == -1) {
      return;
    }
    AppWidgetHostView hostView = mLauncher.getAppWidgetHost().createView(
        (Context) mLauncher, mWidgetLoadingId, pInfo);
    mInfo.boundWidget = hostView;
    // We used up the widget Id in binding the above view.
    mWidgetLoadingId = -1;
    hostView.setVisibility(View.INVISIBLE);
    int[] unScaledSize = mLauncher.getWorkspace().estimateItemSize(mInfo, false, true);
    // We want the first widget layout to be the correct size. This will be important
    // for width size reporting to the AppWidgetManager.
    DragLayer.LayoutParams lp = new DragLayer.LayoutParams(unScaledSize[0],
        unScaledSize[1]);
    lp.x = lp.y = 0;
    lp.customPosition = true;
    hostView.setLayoutParams(lp);
    mLauncher.getDragLayer().addView(hostView);
    mView.setTag(mInfo);
  }
};

代码示例来源:origin: klinker24/Android-Blur-Launcher

@Override
  public void run() {
    if (LOGD) {
      Log.d(TAG, "Inflating widget, id: " + mWidgetLoadingId);
    }
    if (mWidgetLoadingId == -1) {
      return;
    }
    AppWidgetHostView hostView = mLauncher.getAppWidgetHost().createView(
        (Context) mLauncher, mWidgetLoadingId, pInfo);
    mInfo.boundWidget = hostView;
    // We used up the widget Id in binding the above view.
    mWidgetLoadingId = -1;
    hostView.setVisibility(View.INVISIBLE);
    int[] unScaledSize = mLauncher.getWorkspace().estimateItemSize(mInfo, false);
    // We want the first widget layout to be the correct size. This will be important
    // for width size reporting to the AppWidgetManager.
    DragLayer.LayoutParams lp = new DragLayer.LayoutParams(unScaledSize[0],
        unScaledSize[1]);
    lp.x = lp.y = 0;
    lp.customPosition = true;
    hostView.setLayoutParams(lp);
    if (LOGD) {
      Log.d(TAG, "Adding host view to drag layer");
    }
    mLauncher.getDragLayer().addView(hostView);
    mView.setTag(mInfo);
  }
};

代码示例来源:origin: klinker24/launcher3

@Override
  public void run() {
    if (LOGD) {
      Log.d(TAG, "Inflating widget, id: " + mWidgetLoadingId);
    }
    if (mWidgetLoadingId == -1) {
      return;
    }
    AppWidgetHostView hostView = mLauncher.getAppWidgetHost().createView(
        (Context) mLauncher, mWidgetLoadingId, pInfo);
    mInfo.boundWidget = hostView;
    // We used up the widget Id in binding the above view.
    mWidgetLoadingId = -1;
    hostView.setVisibility(View.INVISIBLE);
    int[] unScaledSize = mLauncher.getWorkspace().estimateItemSize(mInfo, false);
    // We want the first widget layout to be the correct size. This will be important
    // for width size reporting to the AppWidgetManager.
    DragLayer.LayoutParams lp = new DragLayer.LayoutParams(unScaledSize[0],
        unScaledSize[1]);
    lp.x = lp.y = 0;
    lp.customPosition = true;
    hostView.setLayoutParams(lp);
    if (LOGD) {
      Log.d(TAG, "Adding host view to drag layer");
    }
    mLauncher.getDragLayer().addView(hostView);
    mView.setTag(mInfo);
  }
};

代码示例来源:origin: WeAreFairphone/FP2-Launcher

@Override
  public void run() {
    if (mWidgetCleanupState != WIDGET_BOUND) {
      return;
    }
    AppWidgetHostView hostView = mLauncher.
        getAppWidgetHost().createView(getContext(), mWidgetLoadingId, pInfo);
    info.boundWidget = hostView;
    mWidgetCleanupState = WIDGET_INFLATED;
    hostView.setVisibility(INVISIBLE);
    int[] unScaledSize = mLauncher.getWorkspace().estimateItemSize(info.spanX,
        info.spanY, info, false);
    // We want the first widget layout to be the correct size. This will be important
    // for width size reporting to the AppWidgetManager.
    DragLayer.LayoutParams lp = new DragLayer.LayoutParams(unScaledSize[0],
        unScaledSize[1]);
    lp.x = lp.y = 0;
    lp.customPosition = true;
    hostView.setLayoutParams(lp);
    mLauncher.getDragLayer().addView(hostView);
  }
};

相关文章