gravity

Android image view gravity

蹲街弑〆低调 提交于 2019-12-23 07:04:22
问题 How can I dynamically set the gravity ? Bitmap bmp; im = new ImageView (this); bmp=getbmp(img); im.setImageBitmap(bmp); Now I would like to put the image in the top . Ho can I do this without android:gravity in main.xml ? EDIT : main.xml <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:scrollbars="vertical" > </ScrollView> I have a frame layout and I add

Manage Layout Inside a Horizontal Oriented Radiogroup

夙愿已清 提交于 2019-12-18 10:44:18
问题 I am using a TableLayout with TableRows as my main activity. Inside the TableLayout is a Radio Group containing 2 Radio Buttons inside the activity (the Radio Group being inside a table row). I want to be able to align the rightmost radio button to the right edge screen, so the "gap" is between the left radio button and right button (instead of after the right radio button). i.e. So instead of having | (x) (x) gap | I will have |(x) gap (x)| where (x) are the Radio Buttons and | are the edges

Android: Edittext with gravity center not working on device

回眸只為那壹抹淺笑 提交于 2019-12-18 02:37:16
问题 In Android I'm using a single line edittext with gravity set to center. In the Emulator this works great both the hint and a blinking cursor shows up. When testing on device (Xperia X10) neither the hint text nor the blinking cursor shows up. The blinking cursor only shows if I enter some text into the edittext. This is my edittext, can anyone see if something is missing? <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android

Why i can't lock DrawerLayout with layout gravity

五迷三道 提交于 2019-12-17 16:56:21
问题 I use DrawerLayout and recently i want to change gravity of listView in drawerLayout. But after i change gravity of listView to android:layout_gravity="start|bottom" from android:layout_gravity="start" , drawerLayout can't be lock to mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); setDrawerLockMode() work with; <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id

Android align text top center

强颜欢笑 提交于 2019-12-12 10:37:02
问题 I'm sorry if this is a duplicate but i couldn't find anything that was quite what I'm looking for. Basically, i want to align the text in the text View to be in the top center. And I would like to do this in XML if possible. So i want to combine android:gravity="center" and android:gravity="top" so that it aligns it with both. I have already tried to put both attributes in the text View element but it just gives an error. 回答1: First, you cannot duplicate the attribute, though you can combine

unity 3.3, create local gravity on object

随声附和 提交于 2019-12-12 10:09:25
问题 Using Unity 3.3. visual studio express 2010. and c#. I need to make a script that will be attached to an object. This object will create its own gravity field that will attract- repel all objects in the environment. Unfortunately I'm not sure how to do this due to unitys physics. would I need the object to overide all other objects? do I overide unitys main physics ? hows this work? Or am I overcomplicating things when its a simple script? No I do not want to add a rigig body so the object

How can I add gravity/friction to my ball object so it doesn't get stuck in no-man's-land?

你。 提交于 2019-12-12 04:58:59
问题 I've recently had a breakthrough on the coding for my skee-ball style game. I was having serious issues with collision detection, which the boffins of stackoverflow have helped me solve. I was coding a tween for my object, a ball, to create a smooth roll effect because I hadn't been able to get it to move smoothly otherwise. I finally had a eureka moment and managed to make the object move incrementally instead of teleporting and was able to eliminate my tween. Without a tween, collision

How do I get a body to bounce around the screen when there is gravity (Box2D/AndEngine)?

梦想与她 提交于 2019-12-11 16:22:01
问题 I've done quite a bit of searching and have found multiple suggestions for anti-gravity objects, but nothing seems to work just right. I have a physics world created with Earth's gravity. The user taps the screen and creates sprites/dynamic bodies. These then fall to the bottom of the screen due to the gravity. I have another sprite/body that is supposed to bounce around the screen, ignoring gravity and bouncing off the sprites that have been created. AndEngine's Box2D does not seem to have

Can not set gravity with setGravity vertically programatically. Is this an android bug or feature?

半城伤御伤魂 提交于 2019-12-11 11:51:59
问题 I have a custom View with four buttons. I created the view in Java because I want to animate the buttons. I want to center the text on the buttons, but I can do this only horizontally (left-right) but not vertically. The text sticks to the top. Here is the most basic code I could get working: public class CopyOfGameView extends ViewGroup implements View.OnClickListener { private Main main; public CopyOfGameView(Context context, AttributeSet attrs) { super(context, attrs); } public

Having some problems trying to put views in the right places

随声附和 提交于 2019-12-11 09:06:39
问题 I'm generating dynamic tablerows in this XML <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="none" > <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layoutPrincipal1" android:layout_width="match_parent" android:layout_height="wrap_content" android:stretchColumns="1"> </TableLayout> </ScrollView> The