use of android.widget.RelativeLayout.LayoutParams in project KJFrameForAndroid by kymjs.
the class NotebookAdapter method getView.
@Override
public View getView(int position, View v, ViewGroup parent) {
NotebookData data = datas.get(position);
ViewHolder holder = null;
if (v == null) {
holder = new ViewHolder();
v = View.inflate(aty, R.layout.item_notebook, null);
holder.titleBar = v.findViewById(R.id.item_note_titlebar);
holder.date = (TextView) v.findViewById(R.id.item_note_tv_date);
holder.state = (ImageView) v.findViewById(R.id.item_note_img_state);
holder.thumbtack = (ImageView) v.findViewById(R.id.item_note_img_thumbtack);
holder.content = (TextView) v.findViewById(R.id.item_note_content);
v.setTag(holder);
} else {
holder = (ViewHolder) v.getTag();
}
RelativeLayout.LayoutParams params = (LayoutParams) holder.content.getLayoutParams();
params.width = width;
params.height = (params.width - height);
holder.content.setLayoutParams(params);
holder.titleBar.setBackgroundColor(NoteEditFragment.sTitleBackGrounds[data.getColor()]);
holder.date.setText(data.getDate());
if (data.getId() > 0) {
holder.state.setVisibility(View.GONE);
} else {
holder.state.setVisibility(View.VISIBLE);
}
holder.thumbtack.setImageResource(NoteEditFragment.sThumbtackImgs[data.getColor()]);
holder.content.setText(Html.fromHtml(data.getContent()).toString());
holder.content.setBackgroundColor(NoteEditFragment.sBackGrounds[data.getColor()]);
if (position == currentHidePosition) {
v.setVisibility(View.GONE);
} else {
v.setVisibility(View.VISIBLE);
}
return v;
}
use of android.widget.RelativeLayout.LayoutParams in project KJFrameForAndroid by kymjs.
the class FindFragment method initWidget.
@Override
protected void initWidget(View parentView) {
super.initWidget(parentView);
LayoutParams params = (LayoutParams) mImgZone.getLayoutParams();
int h = params.height = (int) (AppContext.screenH * 0.3);
params.width = AppContext.screenW;
mImgZone.setLayoutParams(params);
kjb.displayLoadAndErrorBitmap(mImgZone, "http://www.kymjs.com/app/user_center_bg" + StringUtils.getDataTime("MMdd") + ".png", R.drawable.user_center_bg, R.drawable.user_center_bg);
int space65 = (int) getResources().getDimension(R.dimen.space_65);
LayoutParams headParams = (LayoutParams) mImgHead.getLayoutParams();
headParams.topMargin = (h - space65) / 2 - 20;
mImgHead.setLayoutParams(headParams);
LayoutParams nameParams = (LayoutParams) mTvName.getLayoutParams();
// 在头像底部间距半个头像的大小
nameParams.topMargin = (h + space65) / 2;
mTvName.setLayoutParams(nameParams);
rootView.setOnViewTopPullListener(new OnViewTopPull() {
@Override
public void onPull() {
if (outsideAty instanceof TitleBarActivity) {
outsideAty.getCurtainView().expand();
}
}
});
}
use of android.widget.RelativeLayout.LayoutParams in project KJFrameForAndroid by kymjs.
the class TweetRecordFragment method initWidget.
@Override
protected void initWidget(View view) {
super.initWidget(view);
RelativeLayout.LayoutParams params = (LayoutParams) mBtnRecort.getLayoutParams();
params.width = DensityUtils.getScreenW(getActivity());
params.height = (int) (DensityUtils.getScreenH(getActivity()) * 0.4);
mBtnRecort.setLayoutParams(params);
mBtnRecort.setOnFinishedRecordListener(new OnFinishedRecordListener() {
@Override
public void onFinishedRecord(String audioPath, int recordTime) {
mLayout.setVisibility(View.VISIBLE);
if (recordTime < 10) {
mTvTime.setText("0" + recordTime + "\"");
} else {
mTvTime.setText(recordTime + "\"");
}
mImgAdd.setVisibility(View.GONE);
filePath = null;
}
@Override
public void onCancleRecord() {
mLayout.setVisibility(View.GONE);
}
});
drawable = (AnimationDrawable) mImgVolume.getBackground();
mBtnRecort.getAudioUtil().setOnPlayListener(new OnPlayListener() {
@Override
public void stopPlay() {
drawable.stop();
mImgVolume.setBackgroundDrawable(drawable.getFrame(0));
}
@Override
public void starPlay() {
mImgVolume.setBackgroundDrawable(drawable);
drawable.start();
}
});
mEtSpeech.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (s.length() > MAX_LEN) {
mTvInputLen.setText("已达到最大长度");
} else {
mTvInputLen.setText("你还可以输入" + (MAX_LEN - s.length()) + "个字");
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void afterTextChanged(Editable s) {
if (s.length() > MAX_LEN) {
mEtSpeech.setText(s.subSequence(0, MAX_LEN));
CharSequence text = mEtSpeech.getText();
if (text instanceof Spannable) {
Selection.setSelection((Spannable) text, MAX_LEN);
}
}
}
});
}
use of android.widget.RelativeLayout.LayoutParams in project musicbrainz-android by jdamcd.
the class DonateFragment method addPayPalButtonToLayout.
private void addPayPalButtonToLayout() {
payPalButton = payPal.getCheckoutButton(context, PayPal.BUTTON_278x43, CheckoutButton.TEXT_DONATE);
payPalButton.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
payPalButton.setOnClickListener(this);
LinearLayout donateButtonLayout = (LinearLayout) layout.findViewById(R.id.donate_button_layout);
donateButtonLayout.addView(payPalButton);
}
use of android.widget.RelativeLayout.LayoutParams in project MaterialDesignLibrary by navasmdc.
the class ProgressBarDeterminate method setAttributes.
// Set atributtes of XML to View
protected void setAttributes(AttributeSet attrs) {
progressView = new View(getContext());
LayoutParams params = new LayoutParams(1, 1);
progressView.setLayoutParams(params);
progressView.setBackgroundResource(R.drawable.background_progress);
addView(progressView);
// Set background Color
// Color by resource
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML, "background", -1);
if (bacgroundColor != -1) {
setBackgroundColor(getResources().getColor(bacgroundColor));
} else {
// Color by hexadecimal
int background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
if (background != -1)
setBackgroundColor(background);
else
setBackgroundColor(Color.parseColor("#1E88E5"));
}
min = attrs.getAttributeIntValue(MATERIALDESIGNXML, "min", 0);
max = attrs.getAttributeIntValue(MATERIALDESIGNXML, "max", 100);
progress = attrs.getAttributeIntValue(MATERIALDESIGNXML, "progress", min);
setMinimumHeight(Utils.dpToPx(3, getResources()));
post(new Runnable() {
@Override
public void run() {
LayoutParams params = (LayoutParams) progressView.getLayoutParams();
params.height = getHeight();
progressView.setLayoutParams(params);
}
});
}
Aggregations