【发布时间】:2018-01-28 16:17:28
【问题描述】:
这是我的页面布局。
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/fullMeetingView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:layout_weight=".1"
android:background="@color/colorPaleGrey2"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="20dp">
<TextView
android:id="@+id/meeting_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:gravity="center_horizontal"
android:text="Entrepreneur Meet Up"
android:textColor="@color/blackDark"
android:textSize="20.1sp"
android:textStyle="normal" />
<TextView
android:id="@+id/time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/meeting_text"
android:layout_centerInParent="true"
android:layout_marginTop="10dip"
android:fontFamily="sans-serif-medium"
android:gravity="center_horizontal"
android:lineSpacingExtra="6sp"
android:text="(11:30AM - 4:00PM)"
android:textColor="@color/bluey_grey_three"
android:textSize="14sp"
android:textStyle="normal" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlmainLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.kdcos.contsync.utilities.dragview.DragLayer
android:id="@+id/framelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</com.kdcos.contsync.utilities.dragview.DragLayer>
<RelativeLayout
android:id="@+id/rl_dropView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/round_bg"
android:padding="30dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="@drawable/ic_drop_cards" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView"
android:layout_centerInParent="true"
android:layout_gravity="center_horizontal|center"
android:fontFamily="sans-serif"
android:gravity="center_horizontal"
android:lineSpacingExtra="10sp"
android:text="Drop Cards Here"
android:textColor="@color/blackDark"
android:textSize="10sp"
android:textStyle="normal" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/delete_zone_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="bottom"
android:orientation="horizontal"
android:visibility="visible">
<ImageView
android:id="@+id/deleteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" android:padding="@dimen/margin_20dp"
android:background="@drawable/ic_delete" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_weight=".2">
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
tools:context="com.guna.navigationviewonbothssides.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
app:elevation="0dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/menuRight"
android:background="@color/colorWhite"
android:minHeight="?attr/actionBarSize"
app:tabGravity="fill"
app:tabIndicatorColor="@color/colorTurquoiseBlue"
app:tabIndicatorHeight="3dp" />
<RelativeLayout
android:id="@+id/menuRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@color/blackDark"
android:padding="10dp"
android:tint="@color/colorPrimary">
<ImageButton
android:layout_width="16dp"
android:layout_height="16dp"
app:srcCompat="@drawable/ic_menu_white_24dp"
/>
</RelativeLayout>
</RelativeLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager_meeting_landscape"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="50dp"
android:background="@color/colorWhite" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:fitsSystemWindows="true">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview_drawer_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:visibility="visible"
android:scrollbars="vertical" />
<TextView
android:id="@+id/empty_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="10dp"
android:scrollbars="vertical"
android:gravity="center"
android:text="@string/no_meeting_fount"
android:visibility="gone" />
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
</LinearLayout>
我想获取弹出位置坐标,以便在我删除列表视图项时可以执行一些操作
我尝试使用 getLocationInWindow() x 和 y 坐标,但我总是得到 x 轴 0 而不是 0 位置我必须获得弹出位置或删除按钮的区域,以便我可以触摸列表视图项目视图来删除位置建议我如何找到删除图像视图坐标或位置。
【问题讨论】:
-
getX() 和 getY() 属性有效吗?...尝试使用它们,我认为这就是你想要的
-
另一件事是你想要相对于屏幕还是相对于父级的坐标?
-
是的@AhmedRajab,但我总是得到错误的坐标,我把它放在底部删除图标,但它的显示 x 轴总是零
-
@AhmedRajab 你对这个解决方案有什么建议
标签: android