[android-developers] set x,y co-ordinates in pixels
in a FrameLayout with two children ImageView and EditText, is there a
way to control by code at runtime the position of the later EditText?
I'm trying to create a floating widget (EditText) much like a toast
but that changes its x,y offsets .
<FrameLayout android:id="@+id/res_FrameLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="10">
<ImageView
android:id="@+id/my_imageview" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center" />
<EditText android:id="@+id/floating_edittext"
android:layout_width="20dip" android:layout_height="wrap_content"
android:singleLine="true" android:ellipsize="end"
android:focusable="true"
android:textSize="18sp" android:textStyle="normal"
android:editable="true" />
</FrameLayout>
--------------------------------
in the activity class ctor:
EditText mFloatingEditText = (EditText)
findViewById(R.id.floating_edittext);
ViewGroup.LayoutParams mlayoutparamo =
mFloatingEditText.getLayoutParams();
mlayoutparamo.height = 40;
mlayoutparamo.width = 200;
mFloatingEditText.setLayoutParams(mlayoutparamo); // this works!
mFloatingEditText.offsetLeftAndRight(30); // does not work!
mFloatingEditText.offsetTopAndBottom(50); // does not work!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home