gravity

Android center view in FrameLayout doesn't work

一世执手 提交于 2019-12-03 14:15:54
问题 I have a FrameLayout in which I have 2 controls: - a custom view which draws a image and some text on it - a textview with a text I want to center both in the FrameLayout but I can't manage to do it. The Texview is centered just fine, my cusom view remains on the left side, when I make it visible. <FrameLayout android:id="@+id/CompassMap" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center"> <view class="com.MyView" android

android remove gravity from accelerometer readings

守給你的承諾、 提交于 2019-12-03 12:04:23
问题 I am developing an application for Android where I need to remove gravity from accelerometer readings. I have read multiple discussions on this problem, I have also found an algorithm here, but I didn't really understand it. I want to filter gravity from each axis, not from the total acceleration. Could you please help me out? My code should be something like: public void onSensorChanged(SensorEvent sensorEvent) { float vals[] = sensorEvent.values; float accelerationX = filterGravity(vals[0])

Center text android button

荒凉一梦 提交于 2019-12-03 09:36:02
My question is very simple. How do I center the text on a button in android? I tried to set padding to 0, gravity to center but the result when i run it still that the text is horizontal centred but not vertical. The text is a bit shifted to the bottom. <Button android:id="@+id/btnSame" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginBottom="10dip" android:layout_marginLeft="10dip" android:layout_marginRight="10dip" android:background="@drawable/layout_button_different" android:gravity="center_vertical|center

Sensor fusion implemented on Android?

妖精的绣舞 提交于 2019-12-03 06:18:38
问题 I listened to this talk: http://www.youtube.com/watch?v=C7JQ7Rpwn2k which is Invensense Inc prototyping their "Sensor fusion" system, which is where they combine gyro, accelerometer, compass measurements in Android, to get better results. Is this currently implemented in any version of Android? The reason I ask is, part of sensor fusion is the "Gravity" sensor and the "Linear Acceleration" sensor, which ARE implemented in Android ever since API Level 9... makes me think that either 1) sensor

Gravity Sort : Is this possible programmatically? [closed]

混江龙づ霸主 提交于 2019-12-03 04:59:56
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 11 months ago . I've been thinking recently on using the Object Oriented design in the sorting algorithm. However I was not able to find a proper way to even come closer in making this sorting algorithm that does the sorting in O(n) time. Ok, here is what I've been thinking for a week. I have a

What is the difference between “gravity” and “acceleration” sensors in Android?

本秂侑毒 提交于 2019-12-03 04:40:13
What is the difference between gravity and acceleration sensors in Android? From my point of view the physical value is the same in both cases. Which one measures the force acting on unit mass inside the device? ADDITION The question is: what physical quantity is measured by these sensors? According to equivalence principle the acceleration and gravity are indistinguishable and the only way to measure both is by usual (but 3d) spring balance. Acceleration sensor gives you back the sum of all forces applied to your device, while Gravity sensor returns only the influence of gravity. If you want

Android center view in FrameLayout doesn't work

二次信任 提交于 2019-12-03 04:08:16
I have a FrameLayout in which I have 2 controls: - a custom view which draws a image and some text on it - a textview with a text I want to center both in the FrameLayout but I can't manage to do it. The Texview is centered just fine, my cusom view remains on the left side, when I make it visible. <FrameLayout android:id="@+id/CompassMap" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center"> <view class="com.MyView" android:id="@+id/myView" android:layout_width="wrap_content" android:layout_height="wrap_content" android

android remove gravity from accelerometer readings

限于喜欢 提交于 2019-12-03 01:42:40
I am developing an application for Android where I need to remove gravity from accelerometer readings. I have read multiple discussions on this problem, I have also found an algorithm here , but I didn't really understand it. I want to filter gravity from each axis, not from the total acceleration. Could you please help me out? My code should be something like: public void onSensorChanged(SensorEvent sensorEvent) { float vals[] = sensorEvent.values; float accelerationX = filterGravity(vals[0]); float accelerationY = filterGravity(vals[1]); float accelerationZ = filterGravity(vals[2]); } What

2D orbital physics

≯℡__Kan透↙ 提交于 2019-12-02 23:01:43
I'm working on a 2D physics engine for a game. I have gravity and masses working, using a simple iterative approach (that I know I'll have to upgrade eventually); I can push the masses around manually and watch them move and it all works as I'd expect. Right now I'm trying to set up the game world in advance with a satellite in a simple circular orbit around a planet. To do this I need to calculate the initial velocity vector of the satellite given the mass of the planet and the desired distance out; this should be trivial, but I cannot for the life of me get it working right. Standard physics

Android中属性gravity和layout_grativy的区别

匿名 (未验证) 提交于 2019-12-02 22:56:40
LinearLayout有两个非常相似的属性:android:gravity与android:layout_gravity。他们的区别在于:android:gravity用于设置View组件的对齐方式,而android:layout_gravity用于设置Container组件的对齐方式。 android:layout_width="200dp" android:layout_height="wrap_content" android:text="234324" android:textColor="#000" 文章来源: Android中属性gravity和layout_grativy的区别