Search in sources :

Example 1 with LayoutParams

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);
    }
}
Also used : LayoutParams(android.widget.RelativeLayout.LayoutParams) Button(android.widget.Button) ChangeBounds(android.transition.ChangeBounds)

Example 2 with LayoutParams

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);
    }
}
Also used : LayoutParams(android.widget.RelativeLayout.LayoutParams) Button(android.widget.Button) ChangeBounds(android.transition.ChangeBounds)

Example 3 with LayoutParams

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);
    }
}
Also used : LayoutParams(android.widget.RelativeLayout.LayoutParams) Button(android.widget.Button) ChangeBounds(android.transition.ChangeBounds)

Example 4 with LayoutParams

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;
}
Also used : LayoutParams(android.widget.RelativeLayout.LayoutParams) LayoutInflater(android.view.LayoutInflater) RelativeLayout(android.widget.RelativeLayout) ChatListAdView(com.my.target.nativeads.views.ChatListAdView) ContentStreamAdView(com.my.target.nativeads.views.ContentStreamAdView) NewsFeedAdView(com.my.target.nativeads.views.NewsFeedAdView) View(android.view.View)

Example 5 with LayoutParams

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;
}
Also used : LayoutParams(android.widget.RelativeLayout.LayoutParams) ViewGroup(android.view.ViewGroup) GridView(android.widget.GridView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) ListAdapter(android.widget.ListAdapter) Point(android.graphics.Point)

Aggregations

LayoutParams (android.widget.RelativeLayout.LayoutParams)22 RelativeLayout (android.widget.RelativeLayout)8 View (android.view.View)7 ChangeBounds (android.transition.ChangeBounds)4 ViewGroup (android.view.ViewGroup)4 Button (android.widget.Button)4 AbsListView (android.widget.AbsListView)3 ListAdapter (android.widget.ListAdapter)3 ListView (android.widget.ListView)3 TextView (android.widget.TextView)3 Point (android.graphics.Point)2 SpannableString (android.text.SpannableString)2 LayoutInflater (android.view.LayoutInflater)2 Animation (android.view.animation.Animation)2 AnimationListener (android.view.animation.Animation.AnimationListener)2 Transformation (android.view.animation.Transformation)2 InputMethodManager (android.view.inputmethod.InputMethodManager)2 GridView (android.widget.GridView)2 SuppressLint (android.annotation.SuppressLint)1 Intent (android.content.Intent)1