use of android.view.ViewGroup.LayoutParams in project Klyph by jonathangerbaud.
the class PostPhotos method updateLayout.
public void updateLayout() {
if (getGridView() != null && getGridView().getAdapter() != null) {
LayoutParams params = getGridView().getLayoutParams();
if (KlyphDevice.isLandscapeMode() || getGridView().getAdapter().getCount() <= getNumColumn()) {
params.height = (int) ((KlyphDevice.getDeviceWidth() - (48 + 8 + 2) * KlyphDevice.getDeviceDensity()) / getNumColumn());
} else {
params.height = (int) ((KlyphDevice.getDeviceWidth() - (48 + 8 + 2) * KlyphDevice.getDeviceDensity()) / (getNumColumn() / 2));
}
getGridView().setLayoutParams(params);
}
}
use of android.view.ViewGroup.LayoutParams in project ViewPagerIndicator by LuckyJayce.
the class LazyFragment method onCreateView.
@Deprecated
protected final void onCreateView(Bundle savedInstanceState) {
super.onCreateView(savedInstanceState);
this.savedInstanceState = savedInstanceState;
Bundle bundle = getArguments();
if (bundle != null) {
isLazyLoad = bundle.getBoolean(INTENT_BOOLEAN_LAZYLOAD, isLazyLoad);
}
//为什么不直接getUserVisibleHint();而是通过自己存isVisibleToUserState变量判断
//因为v4的25的版本 已经调用 setUserVisibleHint(true),结果到这里getUserVisibleHint是false
// (ps:看了FragmentManager源码Fragment被重新创建有直接赋值isVisibleToUser不知道是不是那里和之前v4有改动的地方)
//所以我默认VISIBLE_STATE_NOTSET,之前没有调用setUserVisibleHint方法,就用系统的getUserVisibleHint,否则就用setUserVisibleHint后保存的值
//总之就是调用了setUserVisibleHint 就使用setUserVisibleHint的值
boolean isVisibleToUser;
if (isVisibleToUserState == VISIBLE_STATE_NOTSET) {
isVisibleToUser = getUserVisibleHint();
} else {
isVisibleToUser = isVisibleToUserState == VISIBLE_STATE_VISIABLE;
}
if (isLazyLoad) {
if (isVisibleToUser && !isInit) {
isInit = true;
onCreateViewLazy(savedInstanceState);
} else {
LayoutInflater layoutInflater = inflater;
if (layoutInflater == null) {
layoutInflater = LayoutInflater.from(getApplicationContext());
}
layout = new FrameLayout(layoutInflater.getContext());
View view = getPreviewLayout(layoutInflater, layout);
if (view != null) {
layout.addView(view);
}
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
super.setContentView(layout);
}
} else {
isInit = true;
onCreateViewLazy(savedInstanceState);
}
}
use of android.view.ViewGroup.LayoutParams in project phonegap-facebook-plugin by Wizcorp.
the class CordovaChromeClient method getVideoLoadingProgressView.
@Override
public /**
* Ask the host application for a custom progress view to show while
* a <video> is loading.
* @return View The progress view.
*/
View getVideoLoadingProgressView() {
if (mVideoProgressView == null) {
// Create a new Loading view programmatically.
// create the linear layout
LinearLayout layout = new LinearLayout(this.appView.getContext());
layout.setOrientation(LinearLayout.VERTICAL);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
layout.setLayoutParams(layoutParams);
// the proress bar
ProgressBar bar = new ProgressBar(this.appView.getContext());
LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
barLayoutParams.gravity = Gravity.CENTER;
bar.setLayoutParams(barLayoutParams);
layout.addView(bar);
mVideoProgressView = layout;
}
return mVideoProgressView;
}
use of android.view.ViewGroup.LayoutParams in project storymaker by StoryMaker.
the class ProjectTagFragment method displayTag.
/**
* Display a tag with text equal to "#" + tag, and View#tag equal
* to tag's String value.
*
* Does not add tag to the Project represented by this Fragment
*/
private void displayTag(String tag) {
Button btnTag = new Button(getActivity());
btnTag.setEnabled(mEditable);
btnTag.setText("#" + tag);
btnTag.setTag(tag);
btnTag.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
btnTag.setOnClickListener(mInternalOnTagClickListener);
if (mSpecialMessageTv != null) {
mContainerProjectTagsView.removeView(mSpecialMessageTv);
}
mContainerProjectTagsView.addView(btnTag, 0);
}
use of android.view.ViewGroup.LayoutParams in project storymaker by StoryMaker.
the class ProjectTagFragment method displayMessage.
/**
* Display a message in a view that spans the entire
* tag pool
*/
private void displayMessage(String message) {
TextView textView = new TextView(getActivity());
textView.setText(message);
textView.setGravity(Gravity.CENTER);
textView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
mSpecialMessageTv = textView;
mContainerProjectTagsView.addView(textView, 0);
}
Aggregations