0

Beginner Android developer. I'm using Eclipse to write and design the app.

Suddenly, TextViews have stopped wrapping text on my physical Android device. Alert dialogs no longer wrap as well. Wrapping works correctly in the designer and in the emulator.

They wrapped correctly on the device the last time I tested it. Since doing so, I've only added a new activity with a few buttons on it. I don't believe I changed anything on the main menu activity, which is below:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" 
android:layout_height="match_parent">

<RelativeLayout
android:id="@+id/textViewRedeem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".ActivityMainMenu" >

<Button
    android:id="@+id/buttonQuickStart"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:onClick="handleQuickStart"
    android:text="@string/buttonQuickStart" />
<Button
    android:id="@+id/buttonLoad"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/textViewLoad"
    android:layout_alignRight="@+id/buttonQuickStart"
    android:layout_below="@+id/textViewNew"
    android:layout_marginTop="18dp"
    android:onClick="handleLoad"
    android:text="@string/buttonLoad" />

<Button
    android:id="@+id/buttonRedeemCode"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/textViewLoad"
    android:layout_below="@+id/textViewLoad"
    android:layout_marginTop="14dp"
    android:onClick="handleRedeem"
    android:text="@string/buttonRedeemCode" />

<Button
    android:id="@+id/buttonNew"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/textViewQuickStart"
    android:layout_alignRight="@+id/buttonQuickStart"
    android:layout_below="@+id/textViewQuickStart"
    android:layout_marginTop="18dp"
    android:onClick="handleNew"
    android:text="@string/buttonNew" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/buttonRedeemCode"
    android:layout_below="@+id/buttonRedeemCode"
    android:text="@string/defineRedeem"
    android:textAppearance="?android:attr/textAppearanceMedium" 
    android:singleLine="false"/>
<TextView 
    android:id="@+id/textViewQuickStart" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignLeft="@+id/buttonQuickStart" 
    android:layout_below="@+id/buttonQuickStart" 
    android:text="@string/defineQuickStart" 
    android:textAppearance="?android:attr/textAppearanceMedium" 
    android:singleLine="false"/>
<TextView android:id="@+id/textViewNew" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignLeft="@+id/buttonNew" 
    android:layout_below="@+id/buttonNew" 
    android:text="@string/defineNew" 
    android:textAppearance="?android:attr/textAppearanceMedium" 
    android:singleLine="false"/>
<TextView 
    android:id="@+id/textViewLoad" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignLeft="@+id/textViewNew" 
    android:layout_below="@+id/buttonLoad" 
    android:text="@string/defineLoad" 
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:singleLine="false" />

The AVD I'm using is an 3.2" HVGA slider with Android 4.3. The actual device I'm testing the app on is a Samsung S7500L with Android 2.3.6 and a 3.65" screen.

4

1 回答 1

0
// try this
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="@dimen/activity_vertical_margin"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:paddingTop="@dimen/activity_vertical_margin"
            tools:context=".ActivityMainMenu" >

    <LinearLayout
            android:id="@+id/textViewRedeem"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:layout_marginTop="5dp"
            android:orientation="vertical">

        <Button
                android:id="@+id/buttonQuickStart"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:onClick="handleQuickStart"
                android:text="@string/buttonQuickStart" />

        <TextView
                android:id="@+id/textViewQuickStart"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/defineQuickStart"
                android:textAppearance="?android:attr/textAppearanceMedium"/>

        <Button
                android:id="@+id/buttonNew"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="18dp"
                android:onClick="handleNew"
                android:text="@string/buttonNew" />

        <TextView android:id="@+id/textViewNew"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="@string/defineNew"
                  android:textAppearance="?android:attr/textAppearanceMedium"/>

        <Button
                android:id="@+id/buttonLoad"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="18dp"
                android:onClick="handleLoad"
                android:text="@string/buttonLoad" />

        <TextView
                android:id="@+id/textViewLoad"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/defineLoad"
                android:textAppearance="?android:attr/textAppearanceMedium"/>

        <Button
                android:id="@+id/buttonRedeemCode"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="14dp"
                android:onClick="handleRedeem"
                android:text="@string/buttonRedeemCode" />

        <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/defineRedeem"
                android:textAppearance="?android:attr/textAppearanceMedium"/>
    </LinearLayout>

</ScrollView>
于 2013-10-07T04:32:16.930 回答