use of android.widget.RelativeLayout.LayoutParams in project android_frameworks_base by ResurrectionRemix.
the class InstanceTargets method sendMessage.
public void sendMessage(final View view) {
TransitionManager.beginDelayedTransition(mSceneRoot, new ChangeBounds().addTarget(view));
for (int i = 0; i < mSceneRoot.getChildCount(); ++i) {
Button button = (Button) mSceneRoot.getChildAt(i);
LayoutParams params = (LayoutParams) button.getLayoutParams();
int[] rules = params.getRules();
if (rules[ALIGN_PARENT_RIGHT] != 0) {
params.removeRule(ALIGN_PARENT_RIGHT);
params.addRule(ALIGN_PARENT_LEFT);
} else {
params.removeRule(ALIGN_PARENT_LEFT);
params.addRule(ALIGN_PARENT_RIGHT);
}
button.setLayoutParams(params);
}
}
use of android.widget.RelativeLayout.LayoutParams in project android_frameworks_base by DirtyUnicorns.
the class InstanceTargets method sendMessage.
public void sendMessage(final View view) {
TransitionManager.beginDelayedTransition(mSceneRoot, new ChangeBounds().addTarget(view));
for (int i = 0; i < mSceneRoot.getChildCount(); ++i) {
Button button = (Button) mSceneRoot.getChildAt(i);
LayoutParams params = (LayoutParams) button.getLayoutParams();
int[] rules = params.getRules();
if (rules[ALIGN_PARENT_RIGHT] != 0) {
params.removeRule(ALIGN_PARENT_RIGHT);
params.addRule(ALIGN_PARENT_LEFT);
} else {
params.removeRule(ALIGN_PARENT_LEFT);
params.addRule(ALIGN_PARENT_RIGHT);
}
button.setLayoutParams(params);
}
}
use of android.widget.RelativeLayout.LayoutParams in project android_frameworks_base by crdroidandroid.
the class InstanceTargets method sendMessage.
public void sendMessage(final View view) {
TransitionManager.beginDelayedTransition(mSceneRoot, new ChangeBounds().addTarget(view));
for (int i = 0; i < mSceneRoot.getChildCount(); ++i) {
Button button = (Button) mSceneRoot.getChildAt(i);
LayoutParams params = (LayoutParams) button.getLayoutParams();
int[] rules = params.getRules();
if (rules[ALIGN_PARENT_RIGHT] != 0) {
params.removeRule(ALIGN_PARENT_RIGHT);
params.addRule(ALIGN_PARENT_LEFT);
} else {
params.removeRule(ALIGN_PARENT_LEFT);
params.addRule(ALIGN_PARENT_RIGHT);
}
button.setLayoutParams(params);
}
}
use of android.widget.RelativeLayout.LayoutParams in project mytarget-android by myTargetSDK.
the class FeedAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
if (getItemViewType(position) == 1) {
RelativeLayout relativeLayout = new RelativeLayout(context);
LayoutParams layoutParams = new LayoutParams(getPx(380), ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
View adView = getAdView();
adView.setLayoutParams(layoutParams);
nativeAd.registerView(adView);
relativeLayout.addView(adView);
convertView = relativeLayout;
} else {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.feed_item_text, parent, false);
}
}
return convertView;
}
use of android.widget.RelativeLayout.LayoutParams in project Lazy by l123456789jy.
the class ViewUtils method getAbsListViewHeightBasedOnChildren.
/**
* get AbsListView height according to every children
*
* @param view view
* @return int
*/
public static int getAbsListViewHeightBasedOnChildren(AbsListView view) {
ListAdapter adapter;
if (view == null || (adapter = view.getAdapter()) == null) {
return 0;
}
int height = 0;
for (int i = 0; i < adapter.getCount(); i++) {
View item = adapter.getView(i, null, view);
if (item instanceof ViewGroup) {
item.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}
item.measure(0, 0);
height += item.getMeasuredHeight();
}
height += view.getPaddingTop() + view.getPaddingBottom();
return height;
}
Aggregations