本文整理汇总了Java中android.view.TextureView.setLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java TextureView.setLayoutParams方法的具体用法?Java TextureView.setLayoutParams怎么用?Java TextureView.setLayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.TextureView
的用法示例。
在下文中一共展示了TextureView.setLayoutParams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTextureView
import android.view.TextureView; //导入方法依赖的package包/类
public TextureView createTextureView() {
//重新为播放器关联TextureView
TextureView textureView = newTextureView();
FrameLayout.LayoutParams params =
new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
Gravity.CENTER);
textureView.setLayoutParams(params);
return textureView;
}
示例2: createSurface
import android.view.TextureView; //导入方法依赖的package包/类
@Override
public View createSurface(Context context) {
mTextureView = new TextureView(context);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
mTextureView.setLayoutParams(params);
mTextureView.setKeepScreenOn(true);
return mTextureView;
}
示例3: init
import android.view.TextureView; //导入方法依赖的package包/类
private void init(Context context) {
showTimeoutMs = DEFAULT_SHOW_TIMEOUT_MS;
formatBuilder = new StringBuilder();
formatter = new Formatter(formatBuilder, Locale.getDefault());
currentWindow = new Timeline.Window();
componentListener = new ComponentListener();
LayoutInflater.from(context).inflate(R.layout.item_video_control, this);
controlLayout = (LinearLayout) findViewById(R.id.video_control_layout);
time = (TextView) findViewById(R.id.time);
timeCurrent = (TextView) findViewById(R.id.time_current);
fullscreen = (ImageView) findViewById(R.id.video_fullscreen);
fullscreen.setOnClickListener(componentListener);
progressBar = (SeekBar) findViewById(R.id.video_controller_progress);
progressBar.setOnSeekBarChangeListener(componentListener);
progressBar.setMax(PROGRESS_BAR_MAX);
videoView = new TextureView(context);
FrameLayout.LayoutParams videoParams = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
videoView.setLayoutParams(videoParams);
videoView.setOnClickListener(componentListener);
thumbnailView = new SimpleDraweeView(context);
FrameLayout.LayoutParams thumbParams = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
.setPlaceholderImage(R.color.loading_color)
.build();
thumbnailView.setHierarchy(hierarchy);
thumbnailView.setLayoutParams(thumbParams);
loadingBar = new ProgressBar(context, null, android.R.attr.progressBarStyle);
FrameLayout.LayoutParams loadingParams = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
loadingParams.gravity = Gravity.CENTER;
loadingBar.setLayoutParams(loadingParams);
loadingBar.setVisibility(GONE);
playView = new ImageView(context);
FrameLayout.LayoutParams playParams = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
playParams.gravity = Gravity.CENTER;
playView.setLayoutParams(playParams);
int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24,
context.getResources().getDisplayMetrics());
playView.setPadding(padding, padding, padding, padding);
playView.setOnClickListener(componentListener);
// setOnClickListener(componentListener);
leftTime = new TextView(context);
FrameLayout.LayoutParams leftParams = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
leftParams.gravity = Gravity.BOTTOM;
leftParams.bottomMargin = padding / 2;
leftParams.leftMargin = padding / 2;
leftTime.setLayoutParams(leftParams);
leftTime.setTextColor(Color.WHITE);
leftTime.setVisibility(GONE);
addView(videoView, 0);
addView(thumbnailView, 1);
addView(loadingBar, 2);
addView(playView, 3);
addView(leftTime, 4);
}