我試圖顯示在3行中的加速度計數據這樣停止文本0.0米/ S2
Z:-3.2米/ s2
機器人:</p> <p>X:9.8米/秒2 <br> Y:不能從移動
但無論我嘗試過什麼,當其中一個值超過9.9或負值時,我似乎無法防止m/s2來回移動。
例如
之前 X:0.0米/秒2
後 X:-5.0米/秒2
我試圖tablelayout但立柱稍稍舒展,RelativeLayout的,LinearLayout中和每一個可能的襯墊組合我能想到的的。
下面是我的XML代碼示例,它位於垂直線性佈局內部。
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="X:"
android:textSize="30sp" />
<TextView
android:id="@+id/x_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="30sp"
android:paddingRight="30sp"
android:text=" "
android:textSize="30sp"/>
<TextView
android:id="@+id/xAccelUnits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "
android:textSize="30sp" />
</LinearLayout>
感謝您的幫助!
太棒了,'layout_width'做了詭計。我已經嘗試了權重,但他們太過沮喪,無法正確並繼續轉移(可能是其他的錯誤)。我感謝你的時間! – Phil 2011-12-19 18:49:08
沒問題。至於體重,它需要一個固定的寬度才能正常工作,因爲/剩餘/空間是分佈式的(0或更多的dp) – njzk2 2011-12-20 08:53:33