Closed lapngodoan closed 9 years ago
Hello, thank you for your issue and interest in my work. Above, I beg your pardon for my english.
I suppose what you want that textview is in wrap content but dont move both buttons. is it right? I'll add another field for that feature, then I'll re-comment. If I am wrong, please re-comment to me.
Thank you for the issue.
Hello. I added the feature that I suppose. I added parameter 'pMoveSiblings' at method 'setTextView_WrapContent' of class 'ScalableLayout' and attached sample code what you want, I suppose. I hope these help.
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
setContentView(ll);
mSL = new ScalableLayout(this, 2000, 500);
mSL.setBackgroundColor(Color.LTGRAY);
ScalableLayout.setLoggable();
ll.addView(mSL, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
Button btn_prev = new Button(this);
btn_prev.setText("Prev");
mSL.addView(btn_prev, 0, 0, 200, 500);
final TextView tv = new TextView(this);
tv.setText("TextView");
tv.setBackgroundColor(Color.RED);
mSL.addView(tv, 1000, 0, 1, 500);
mSL.setTextView_WrapContent(tv, TextView_WrapContent_Direction.Center_Horizontal, false, false);
Button btn_next = new Button(this);
btn_next.setText("Next");
mSL.addView(btn_next, 1800, 0, 200, 500);
Button btn_small = new Button(this);
btn_small.setText("Small");
btn_small.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tv.setText(tv.getText().toString().substring(0, tv.getText().length()/2));
}
});
ll.addView(btn_small, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
Button btn_large = new Button(this);
btn_large.setText("large");
btn_large.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tv.setText(tv.getText()+"testtest");
}
});
ll.addView(btn_large, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
Hi Youngmann Kim, This new update is what I really want.It helps me resolve my issues a lot. But I think, it'd better if we have TextView_WrapContent_Direction.Center_Vertical and TextView_WrapContent_Direction.Center (for both direction). How do you think about this? Anyway, thank for your great news!
Yeah, you're right. I'll do it as soon as, then re-comment here.
Thanks. :)
Uhm...
TextView_WrapContent_Direction.Center_Vertical will be implemented easily.
But TextView_WrapContent_Direction.Center makes me confused.... Let me think about it.
Thanks :)
I'm sorry for late update.
I Implemented TextView_WrapContent_Direction.Center_Vertical. But I can't make TextView_WrapContent_Direction.Center, because I can't decide which direction is right to expand.
Thanks. :)
Hi Ssomai, Thank for your library. I have a question. In the ScalableLayout, how can we put a view in the center of this layout? For example, in the scalable layout, I have 3 view: PreviousButton ---- TextView -----NextButton The content of textview is changed dynamically. How to ensure this text is alway the center of the layout? (Like RelaytiveLayout) Thank