TabActivity在内容中设置的TextView不按屏幕拉伸;它正在被包裹

时间:2012-07-11 05:52:41

标签: android android-layout

我在LinearLayout中添加了四个textview,如下所示。

<LinearLayout
    android:id="@+id/aboutLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/transparentbg"
    android:orientation="vertical">

    <ScrollView
        android:id="@+id/scrollView2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:fitsSystemWindows="true"
        android:focusable="true">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/blackbutton"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/aboutTitle"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="5dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:text="@string/aboutTitle"
                android:textColor="@color/white_color"
                android:textSize="17dp"
                android:textStyle="bold"
                android:layout_weight="1"/>

            <TextView
                android:id="@+id/aboutDesc"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_margin="10dp"
                android:text="@string/aboutText"
                android:textSize="16dp"
                android:layout_weight="1"/>

            <TextView
                android:id="@+id/howToUse"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="5dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="10dp"
                android:text="@string/howToUseTitle"
                android:textColor="@color/white_color"
                android:textSize="17dp"
                android:textStyle="bold"
                android:layout_weight="1"/>

            <TextView
                android:id="@+id/howToUseDesc"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_margin="10dp"
                android:text="@string/howToUse"
                android:textSize="16dp"
                android:layout_weight="1"/>
        </LinearLayout>
    </ScrollView>
</LinearLayout>

但是文本被gettting包裹,文本被截断了。可能有什么不对?这是我在三星Galaxy Note测试时的折腾,但在Galaxy Nexus中,似乎完全正常。

此视图设置为TabHost的内容,如下所示

final TabHost tabHost = getTabHost();
LayoutInflater.from(this).inflate(R.layout.main, tabHost.getTabContentView(), true);

tabHost.addTab(tabHost.newTabSpec("Altimeter")
        .setIndicator("",getResources().getDrawable(R.drawable.altimeter_32))
        .setContent(R.id.altimeter));
tabHost.addTab(tabHost.newTabSpec("Settings")
        .setIndicator("",getResources().getDrawable(android.R.drawable.ic_menu_manage))
        .setContent(R.id.settingsAltimeter));
tabHost.addTab(tabHost.newTabSpec("About")
        .setIndicator("",getResources().getDrawable(android.R.drawable.ic_menu_info_details))
        .setContent(R.id.aboutLayout));

文本设置为这样的字符串:

<string name="howToUse">1) Detects transformation gestures involving more than one pointer ("multitouch") \nDetects transformation gestures involving more than one pointer ("multitouch") \n\n 2)Detects transformation gestures involving more than one pointer ("multitouch") y.\n\n 3) Detects transformation gestures involving more than one pointer ("multitouch") .\n\n 4) Detects transformation gestures involving more than one pointer ("multitouch") \n\n 5) Detects transformation gestures involving more than one pointer ("multitouch") \n\n</string>

1 个答案:

答案 0 :(得分:-1)

我分配给导致此问题的活动是一个错误的主题。