use of android.widget.LinearLayout.LayoutParams in project Anki-Android by Ramblurr.
the class EditFieldActivity method createSpareMenu.
private void createSpareMenu(LinearLayout linearLayout) {
LayoutParams pars = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1);
Button toTextButton = new Button(this);
toTextButton.setText(gtxt(R.string.multimedia_editor_field_editing_text));
toTextButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
toTextField();
}
});
linearLayout.addView(toTextButton, pars);
Button toImageButton = new Button(this);
toImageButton.setText(gtxt(R.string.multimedia_editor_field_editing_image));
toImageButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
toImageField();
}
});
linearLayout.addView(toImageButton, pars);
Button toAudioButton = new Button(this);
toAudioButton.setText(gtxt(R.string.multimedia_editor_field_editing_audio));
toAudioButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
toAudioField();
}
});
linearLayout.addView(toAudioButton, pars);
Button doneButton = new Button(this);
doneButton.setText(gtxt(R.string.multimedia_editor_field_editing_done));
doneButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
done();
}
});
linearLayout.addView(doneButton, pars);
}
use of android.widget.LinearLayout.LayoutParams in project gesture-imageview by jasonpolites.
the class StandardImageProgrammatic method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.empty);
LayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
view = new GestureImageView(this);
view.setImageResource(R.drawable.image);
view.setLayoutParams(params);
ViewGroup layout = (ViewGroup) findViewById(R.id.layout);
layout.addView(view);
}
use of android.widget.LinearLayout.LayoutParams in project nmid-headline by miao1007.
the class EditPage method getAtLine.
// if platform selected form platform gridview is SinaWeibo,
// TencentWeibo, Facebook, or Twitter, there will be a button
// in the left-bottom of the page, which provides At-friends function
private LinearLayout getAtLine(String platform) {
if (!isShowAtUserLayout(platform)) {
return null;
}
LinearLayout llAt = new LinearLayout(getContext());
LayoutParams lpAt = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpAt.rightMargin = dipToPx(getContext(), 4);
lpAt.gravity = Gravity.LEFT | Gravity.BOTTOM;
lpAt.weight = 1;
llAt.setLayoutParams(lpAt);
llAt.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
FollowListPage subPage = new FollowListPage();
subPage.setPlatform(platforms.get(0));
subPage.showForResult(activity, null, EditPage.this);
}
});
TextView tvAt = new TextView(getContext());
int resId = getBitmapRes(activity, "btn_back_nor");
if (resId > 0) {
tvAt.setBackgroundResource(resId);
}
int dp_32 = dipToPx(getContext(), 32);
tvAt.setLayoutParams(new LayoutParams(dp_32, dp_32));
tvAt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
tvAt.setText(getAtUserButtonText(platform));
int dp_2 = dipToPx(getContext(), 2);
tvAt.setPadding(0, 0, 0, dp_2);
tvAt.setTypeface(Typeface.DEFAULT_BOLD);
tvAt.setTextColor(0xff000000);
tvAt.setGravity(Gravity.CENTER);
llAt.addView(tvAt);
TextView tvName = new TextView(getContext());
tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
tvName.setTextColor(0xff000000);
resId = getStringRes(activity, "list_friends");
String text = getContext().getString(resId, getName(platform));
tvName.setText(text);
LayoutParams lpName = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpName.gravity = Gravity.CENTER_VERTICAL;
tvName.setLayoutParams(lpName);
llAt.addView(tvName);
return llAt;
}
use of android.widget.LinearLayout.LayoutParams in project nmid-headline by miao1007.
the class EditPage method getBodyBottom.
private LinearLayout getBodyBottom() {
LinearLayout llBottom = new LinearLayout(getContext());
llBottom.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
LinearLayout line = getAtLine(platforms.get(0).getName());
if (line != null) {
llBottom.addView(line);
}
// Words counter
tvCounter = new TextView(getContext());
tvCounter.setText(String.valueOf(MAX_TEXT_COUNT));
tvCounter.setTextColor(0xffcfcfcf);
tvCounter.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
tvCounter.setTypeface(Typeface.DEFAULT_BOLD);
LayoutParams lpCounter = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lpCounter.gravity = Gravity.CENTER_VERTICAL;
tvCounter.setLayoutParams(lpCounter);
llBottom.addView(tvCounter);
return llBottom;
}
use of android.widget.LinearLayout.LayoutParams in project MaterialDesignLibrary by navasmdc.
the class ColorSelector method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.color_selector);
view = (LinearLayout) findViewById(R.id.contentSelector);
backView = (RelativeLayout) findViewById(R.id.rootSelector);
backView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getX() < view.getLeft() || event.getX() > view.getRight() || event.getY() > view.getBottom() || event.getY() < view.getTop()) {
dismiss();
}
return false;
}
});
colorView = findViewById(R.id.viewColor);
colorView.setBackgroundColor(color);
// Resize ColorView
colorView.post(new Runnable() {
@Override
public void run() {
LayoutParams params = (LayoutParams) colorView.getLayoutParams();
params.height = colorView.getWidth();
colorView.setLayoutParams(params);
}
});
// Configure Sliders
red = (Slider) findViewById(R.id.red);
green = (Slider) findViewById(R.id.green);
blue = (Slider) findViewById(R.id.blue);
int r = (this.color >> 16) & 0xFF;
int g = (this.color >> 8) & 0xFF;
int b = (this.color >> 0) & 0xFF;
red.setValue(r);
green.setValue(g);
blue.setValue(b);
red.setOnValueChangedListener(this);
green.setOnValueChangedListener(this);
blue.setOnValueChangedListener(this);
}
Aggregations