如何设计比手机屏幕更大的布局?

Van*_*nel 5 eclipse layout android

我正在开发一个Android应用程序,我想在eclipse中设计一个大于屏幕高度的布局.

我有一个片段的布局,这个片段将在一个ScrollView开启FragmentActivity.

这是我片段的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/user_pro_main_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/text_state"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/layout_state"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android:layout_height="match_parent"在eclipse的设计师身上,我是否需要进行更改以使其更大?

如果我想在eclipse设计器上看到更大的布局,我该怎么办?

Cho*_*hun 1

您始终可以在layout_height中显式设置确切的dp值,但当然大多数时候我认为您不需要固定值,因此以编程方式进行。

LinearLayout yourLayout; // Get it by findViewById()
yourLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, your_calculated_height));
Run Code Online (Sandbox Code Playgroud)