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));
}
}
});
}
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());
}
});
}
}
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;
}
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;
}
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;
}
Aggregations