没有在片段android中的textview中显示全文

时间:2016-05-02 10:36:23

标签: java android eclipse performance android-fragments

我在Eclipse开发Android应用,我使用framelayout作为fragment的容器...而fragment未显示全文......一半的文字藏起来...... 请帮帮我...... !!! 提前谢谢......

activty_main.xml`

    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:orientation="vertical">

        <ScrollView
            android:id="@+id/scrollView2"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >


                <FrameLayout
    android:id="@+id/fragment_place"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    android:focusable="true"/>

        </ScrollView>
  `

fragment_about.xml

    <LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:padding="10dp">

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="About Us"
        android:textColor="#F44336"
        android:layout_gravity="center"
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:textSize="30dp"/>

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
         android:textColor="#2196F3"
        android:text="         Our vision is to interrelate the old and present students of college with each other and to develop a constant interaction among them.This also serves as a good opportunity to get the required career guidance to reach their future endeavours."
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <View
        android:id="@+id/view1"
        android:layout_width="wrap_content"
        android:layout_height="9dp"
        />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#2196F3"
        android:text="        We provide e-library to our students which compraises many number of e-books, projects and all fundamentals of electronics"
        android:textAppearance="?android:attr/textAppearanceLarge" />


    <View
        android:id="@+id/view2"
        android:layout_width="wrap_content"
        android:layout_height="9dp"
        />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
         android:textColor="#2196F3"
        android:text="        We automized our students internal/external marks system so, every student can log on to his account and get his/her result at any time after the results are out"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</LinearLayout>

原始片段是Original 但输出结果为output 剩下的部分丢失了 提前致谢

2 个答案:

答案 0 :(得分:1)

请尝试一次。保持activity_main.xml不变。如果fragment_about.xml将根视图设置为ScrollView,只需在下面添加一个视图即可。

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


                   <LinearLayout 
           android:layout_width="match_parent"
                     android:layout_height="match_parent"
            android:orientation="vertical"
            android:padding="10dp">

            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="About Us"
                android:textColor="#F44336"
                android:layout_gravity="center"
                android:textAppearance="?android:attr/textAppearanceLarge" 
                android:textSize="30dp"/>

            <TextView
                android:id="@+id/textView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                 android:textColor="#2196F3"
                android:text="         Our vision is to interrelate the old and present students of college with each other and to develop a constant interaction among them.This also serves as a good opportunity to get the required career guidance to reach their future endeavours."
                android:textAppearance="?android:attr/textAppearanceLarge" />

            <View
                android:id="@+id/view1"
                android:layout_width="wrap_content"
                android:layout_height="9dp"
                />

            <TextView
                android:id="@+id/textView3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#2196F3"
                android:text="        We provide e-library to our students which compraises many number of e-books, projects and all fundamentals of electronics"
                android:textAppearance="?android:attr/textAppearanceLarge" />


            <View
                android:id="@+id/view2"
                android:layout_width="wrap_content"
                android:layout_height="9dp"
                />

            <TextView
                android:id="@+id/textView4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                 android:textColor="#2196F3"
                android:text="        We automized our students internal/external marks system so, every student can log on to his account and get his/her result at any time after the results are out"
                android:textAppearance="?android:attr/textAppearanceLarge" />
    <View
                android:layout_width="match_parent"
                android:layout_height="25dp"/>
 </LinearLayout>
                    </ScrollView>

Hope it will help.

答案 1 :(得分:0)

试试这样  main_activity.xml()

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


        <FrameLayout
             android:id="@+id/fragment_place"
             android:layout_width="match_parent"
             android:layout_height="match_parent" 
             android:focusable="true"/>

        </ScrollView>