0

嗨,我需要一些帮助来理解 Android 的这个属性/功能......

也许我可以四处寻找错误的东西......但我几乎可以肯定我需要使用向下滑动“属性”来查看我的文本视图的其余部分......对吗?

但是怎么做?没看懂流量。。。

要影响的区域。

public class PrintBtInvoice extends Activity
{
    String constActivityName = "PrintBtInvoice";
    // ------------------------------------------------------------------------

    ScrollView  sView = null;
    TextView txtIDorder = null;
    TextView txt2Print = null;
    TextView txt2View = null;

    Button btnBack = null;
    Button btnPrint = null;

    public void onCreate(Bundle savedInstanceState)
    { 

         sView = (ScrollView) findViewById(R.id.scrollView );
         txtIDorder = (TextView) findViewById(R.id.txtPBIorderId);
         txt2Print = (TextView) findViewById(R.id.txtPBIinvoice2print);
         txt2View = (TextView) findViewById(R.id.txtPBIinvoice2view);

         btnBack = (Button) findViewById(R.id.btnPBIback);
         btnPrint = (Button) findViewById(R.id.btnPBIprint);
         ...
    }

    btnPrint.setOnClickListener(new OnClickListener()
    { ... }
}

我需要做什么才能看到我的 text2Print 的其余部分?

建议的更改:)

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/scrollView"
    android:layout_gravity="center_horizontal" >
    <TextView
         android:id="@+id/txtPBIinvoice2print"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/btnPBIback"
        android:layout_toLeftOf="@+id/btnPBIprint"
        android:text="@string/app_blank" />
</ScrollView>
4

1 回答 1

1

我认为您需要将 TextView 放入 ScrollView。这样您就可以向下滚动文本并查看它。这是示例 XML 布局:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/scrollView"
        android:layout_gravity="center_horizontal" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Text"
            android:id="@+id/textView" />
    </ScrollView>
</LinearLayout>
于 2013-10-22T12:52:23.327 回答