我在使用ScrollView
和时遇到了一些问题ImageView
。
我想要的是:
我ImageView
总是在屏幕顶部设置一组。然后,我有一个ScrollView
where 的所有元素,View
在其中我有另一个ImageView
,当前面的元素没有填满屏幕(通常是大屏幕)时,它设置在屏幕底部,它设置在底部何时存在ScrollView
滚动。
我有其他Activities
人没问题,但我有一些Activity
问题FrameLayout
。
我得到的是:
(见下面的代码)当我设置RelativeLayout
的ImageView
(留在底部的那个)height = "wrap_content"
:
- 纵向:
Image
没有实际尺寸,因为它不适合屏幕。为了适应它,Scroll
应该出现。-> 我不知道为什么它不像 otherActivities
. - 横向:
ImageView
出现在屏幕底部。由于其他元素不适合屏幕,Scroll
出现在FrameLayout
.
当我设置(留在底部的那个)RelativeLayout
(图像的实际高度较小)时:ImageView
height = "200dp"
- 纵向:
Image
不出现。没有Scroll
(没有必要,因为可以看到其他元素)。 - 在横向:出现两个
Scrolls
。一个内部FrameLayout
用于元素,另一个用于查看ImageView
.
这是我的最新代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="fill_parent"
tools:context=".FacturasActivity"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayoutLogoFactor_factura"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<ImageView
android:id="@+id/imageViewLogoFactor_factura"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/logo_factorenergia"/>
</LinearLayout>
<ScrollView
android:id="@+id/scrollViewMain"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<LinearLayout
android:id="@+id/linearLayoutMain2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_gravity="center_horizontal"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayoutDireccionFactura"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="10dp"
android:weightSum="1.0">
<TextView
android:id="@+id/textViewlabelDireccionFactura"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:text="@string/etiqueta_direccion"
android:textSize="@dimen/textSize"
android:textStyle="bold" />
<TextView
android:id="@+id/textViewDireccion"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:textSize="@dimen/textSize" />
</LinearLayout>
<FrameLayout
android:id="@+id/frameLayoutFacturas"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="10dp" >
<ListView
android:id="@android:id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@android:id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/facturas_vacia"
android:textSize="@dimen/textSize" />
</FrameLayout>
<RelativeLayout
android:id="@+id/linearLayoutImagenInferior_main"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" >
<ImageView
android:id="@+id/imageViewImagenInferior_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:src="@drawable/la_electrica_de_las_empresas" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
你能帮助我吗?提前致谢。