Используйте LinearLayout
(или другой ViewGroup
как RelativeLayout
) и положить TextView
(и другие компоненты) внутри него:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
Из кода
LinearLayout container = (LinearLayout) findViewById(R.id.container);
container.setVisibility(View.VISIBLE); //to show it
или
container.setVisibility(View.GONE); //to hide it
Ах, o k, и я могу положить несколько 'LinearLayout' в scrollview? Я предположил, что могу использовать только один макет на экран/форму. – Michel
ScrollView может содержать только один LinearLayout (или другую ViewGroup), но внутри него вы можете использовать несколько LinearLayout. Остерегайте вложенную ViewGroup (для производительности). Я предлагаю улучшить ваши знания RelativeLayout, которые могут упростить дерево рендеринга активности. –