【发布时间】:2020-08-17 07:23:08
【问题描述】:
在我的 android 应用程序中,我使用了一个简单的屏幕,其中包含一个封装在 RelativeLayout 中的 MPandroidchart,顶部有一个后退按钮。按钮没有响应。
如果我将RelativeLayout 更改为LinearLayout,按钮(可点击的图像视图)会按预期工作。但是,我确实需要 RelativeLayout 才能使我的 MPAndroidchart 正常工作。任何想法如何使按钮工作?
该按钮应位于图表上方的左上角。
下面的 XML:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
android:orientation="vertical"
tools:context="com.example.erik.myroom.Frontend.Fragment_Statistic">
<ImageView
android:id="@+id/back_from_statistic"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_weight="1"
android:gravity="center_vertical|start"
android:layout_marginTop="@dimen/material_drawer_vertical_padding"
android:clickable="true"
app:ico_color="@color/md_black_1000"
app:ico_icon="@string/gmd_arrow_back"
app:ico_size="16dp"/>
<com.github.mikephil.charting.charts.HorizontalBarChart
android:id="@+id/testchart"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
</layout>
【问题讨论】:
-
你想把 ImageView 放在哪里?
-
在左上角,图表上方。
标签: android imageview android-imageview mpandroidchart xml-layout