首页 > 解决方案 > 下拉菜单的 textView 位置

问题描述

Xamarin Android

我正在尝试制作下拉菜单。我不知道,我做错了什么。

我不能像我想要的那样定位 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>

我有

我有的

我想

我想要的是

有人可以帮我解决这个问题吗?

标签: c#xamarinxamarin.android

解决方案


android:layout_above="@+id/btnImgExpander"在 TextView 上android:layout_alignParentBottom="true"设置,但在 ImageView 上设置,将其与容器底部(外部 RelativeLayout)对齐。您可以尝试:android:layout_alignParentTop="true"并删除android:layout_alignParentBottom="true"


推荐阅读