I'm having a problem whereby a string in textview is displaying each character on seperate lines. My code is as below. I am hoping to show the text on one line.
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp" >
<NumberPicker
android:id="@+id/numberPicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:background="@drawable/button"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
<TextView
android:id="@+id/sectionPicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_marginLeft="10dp"
android:text="AM"
android:textSize="18sp"
android:background="@drawable/button"
android:layout_toRightOf="@+id/numberPicker"
android:layout_centerVertical="true" />
</RelativeLayout>
The problem was that like @mbm29414 suggested I had another relative layout that the above was nested in and this layout had a left/right margin that was limiting this layouts size. The parent layout had a horizontal margin set to 40dp. I discovered this by rotating the screen and noticing a change.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.