我正在尝试制作滑动菜单。 我不知道,我做错了什么。
我不能像我想要的那样定位textView。 视图应位于屏幕顶部。但是,它位于底部。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minWidth="25px"
android:minHeight="25px"
android:background="#f2f2f2">
<RelativeLayout
android:id="@+id/productTitleBar"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="55dp"
android:background="#ff46a1e1">
<TextView
android:id="@+id/txtProductTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:text="Product List"
android:layout_gravity="center"
android:clickable="true"
android:layout_centerVertical="true"
android:textSize="18dp"
android:layout_centerHorizontal="true" />
</RelativeLayout>
<TextView
android:id="@+id/txtDescription"
android:layout_width="match_parent"
android:layout_height="100dp"
android:textColor="#000000"
android:text="Desription goes here"
android:layout_gravity="center"
android:clickable="true"
android:textSize="18dp"
android:layout_above="@+id/btnImgExpander"
android:background="#FFFFFF"
android:gravity="center"
android:visibility="gone" />
<ImageView
android:id="@+id/btnImgExpander"
android:layout_alignParentBottom="true"
android:layout_height="30dp"
android:layout_width="match_parent"
android:src="@drawable/up_arrow"
android:background="#fff2f2f2" />
<ListView
android:id="@+id/productListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="55dp"
android:layout_marginBottom="30dp"
android:background="@android:color/background_light"
android:fastScrollEnabled="true" />
</RelativeLayout>
我有
我想要
有人可以帮我解决这个问题吗?
答案 0 :(得分:0)
android:layout_above="@+id/btnImgExpander"
,但是在ImageView上设置了android:layout_alignParentBottom="true"
,它将它与容器的底部(外部RelativeLayout)对齐。您可以尝试:android:layout_alignParentTop="true"
并删除android:layout_alignParentBottom="true"