Search in sources :

Example 41 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project platform_frameworks_base by android.

the class DelayedTransition method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.two_buttons);
    final Button button1 = (Button) findViewById(R.id.button1);
    final Button button2 = (Button) findViewById(R.id.button2);
    final LinearLayout container = (LinearLayout) findViewById(R.id.container);
    button1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            int buttonWidth = button1.getWidth();
            int containerWidth = container.getWidth();
            if (buttonWidth < containerWidth) {
                TransitionManager.beginDelayedTransition(container, null);
                button1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
                TransitionManager.beginDelayedTransition(container, null);
                button2.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
            } else {
                TransitionManager.beginDelayedTransition(container, null);
                button1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
                TransitionManager.beginDelayedTransition(container, null);
                button2.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
            }
        }
    });
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) Button(android.widget.Button) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 42 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project KJFrameForAndroid by kymjs.

the class KJEmojiFragment method initWidget.

private void initWidget(View rootView) {
    // title
    mEmojiTitle = rootView.findViewById(R.id.emoji_title);
    mEt = (EditText) mEmojiTitle.findViewById(R.id.emoji_titile_input);
    mCBox = (CheckBox) mEmojiTitle.findViewById(R.id.emoji_title_menu);
    mCBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                showEmojiKeyBoard();
                hideSoftKeyboard();
            } else {
                hideEmojiKeyBoard();
                showSoftKeyboard();
            }
        }
    });
    // bottom
    mEmojiBottom = (RadioGroup) rootView.findViewById(R.id.emoji_bottom);
    // 减一是因为有一个删除按钮
    EMOJI_TAB_CONTENT = mEmojiBottom.getChildCount() - 1;
    mEmojiTabs = new View[EMOJI_TAB_CONTENT];
    if (EMOJI_TAB_CONTENT <= 1) {
        // 只有一个分类的时候就不显示了
        mEmojiBottom.setVisibility(View.GONE);
    }
    for (int i = 0; i < EMOJI_TAB_CONTENT; i++) {
        mEmojiTabs[i] = mEmojiBottom.getChildAt(i);
        mEmojiTabs[i].setOnClickListener(getBottomBarClickListener(i));
    }
    mEmojiBottom.findViewById(R.id.emoji_bottom_del).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            InputHelper.backspace(mEt);
        }
    });
    // content必须放在bottom下面初始化
    mEmojiContent = (LinearLayout) rootView.findViewById(R.id.emoji_content);
    LayoutParams params = (LayoutParams) mEmojiContent.getLayoutParams();
    params.height = EMOJI_TAB_CONTENT > 1 ? KJEmojiConfig.MORE_TYPE_HEIGHT : KJEmojiConfig.SINGLE_TYPE_HEIGHT;
    mEmojiContent.setLayoutParams(params);
    mEmojiPager = (ViewPager) mEmojiContent.findViewById(R.id.emoji_pager);
    adapter = new EmojiPagerAdapter(getFragmentManager());
    mEmojiPager.setAdapter(adapter);
    mKeyboardHelper = new SoftKeyboardStateHelper(getActivity().getWindow().getDecorView());
    mKeyboardHelper.addSoftKeyboardStateListener(this);
    if (getActivity() instanceof OnSendClickListener) {
        listener = (OnSendClickListener) getActivity();
        mEmojiTitle.findViewById(R.id.emoji_title_send).setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                listener.onClickSendButton(mEt.getText());
            }
        });
    }
}
Also used : OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) LayoutParams(android.widget.LinearLayout.LayoutParams) OnClickListener(android.view.View.OnClickListener) View(android.view.View) SoftKeyboardStateHelper(org.kymjs.emoji.helper.SoftKeyboardStateHelper) CompoundButton(android.widget.CompoundButton) EmojiPagerAdapter(org.kymjs.emoji.adapter.EmojiPagerAdapter)

Example 43 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project android-app by eoecn.

the class UserCollectFragment method CreateSide.

private ImageView CreateSide() {
    ImageView img = new ImageView(mContext);
    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
    img.setLayoutParams(params);
    img.setBackgroundResource(R.drawable.dis_behind_verticalside);
    return img;
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) ImageView(android.widget.ImageView)

Example 44 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project android-app by eoecn.

the class PopupWindowUtil method getImageView.

private static ImageView getImageView(Context context) {
    ImageView img = new ImageView(context);
    img.setBackgroundResource(R.drawable.dis_popup_side);
    img.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    return img;
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) ImageView(android.widget.ImageView)

Example 45 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project nmid-headline by miao1007.

the class EditPage method getPlatformList.

// platform logos
private LinearLayout getPlatformList() {
    LinearLayout llToolBar = new LinearLayout(getContext());
    LayoutParams lpTb = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    llToolBar.setLayoutParams(lpTb);
    TextView tvShareTo = new TextView(getContext());
    int resId = getStringRes(activity, "share_to");
    if (resId > 0) {
        tvShareTo.setText(resId);
    }
    tvShareTo.setTextColor(0xffcfcfcf);
    tvShareTo.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    int dp_9 = dipToPx(getContext(), 9);
    LayoutParams lpShareTo = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lpShareTo.gravity = Gravity.CENTER_VERTICAL;
    lpShareTo.setMargins(dp_9, 0, 0, 0);
    tvShareTo.setLayoutParams(lpShareTo);
    llToolBar.addView(tvShareTo);
    HorizontalScrollView sv = new HorizontalScrollView(getContext());
    sv.setHorizontalScrollBarEnabled(false);
    sv.setHorizontalFadingEdgeEnabled(false);
    LayoutParams lpSv = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lpSv.setMargins(dp_9, dp_9, dp_9, dp_9);
    sv.setLayoutParams(lpSv);
    llToolBar.addView(sv);
    llPlat = new LinearLayout(getContext());
    llPlat.setLayoutParams(new HorizontalScrollView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    sv.addView(llPlat);
    return llToolBar;
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) TextView(android.widget.TextView) HorizontalScrollView(android.widget.HorizontalScrollView) LinearLayout(android.widget.LinearLayout)

Aggregations

LayoutParams (android.widget.LinearLayout.LayoutParams)78 LinearLayout (android.widget.LinearLayout)44 View (android.view.View)36 TextView (android.widget.TextView)24 ImageView (android.widget.ImageView)17 Button (android.widget.Button)16 ProgressBar (android.widget.ProgressBar)9 Message (android.os.Message)8 OnClickListener (android.view.View.OnClickListener)8 ScrollView (android.widget.ScrollView)7 Handler (android.os.Handler)6 ViewGroup (android.view.ViewGroup)6 WebView (android.webkit.WebView)6 HorizontalScrollView (android.widget.HorizontalScrollView)5 ChangeBounds (android.transition.ChangeBounds)4 Crossfade (android.transition.Crossfade)4 Scene (android.transition.Scene)4 TransitionSet (android.transition.TransitionSet)4 SurfaceView (android.view.SurfaceView)4 TextureView (android.view.TextureView)4