在向我的布局添加scrollview时遇到问题。如果我将方向更改为横向和滚动,则视图似乎重叠
以下是布局文件中的代码。任何人都可以帮我弄清楚为什么细节和图表重叠???
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout 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:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<com.github.mikephil.charting.charts.LineChart
android:id="@+id/line_chart"
android:layout_width="match_parent"
android:layout_height="300dp"></com.github.mikephil.charting.charts.LineChart>
<android.support.v7.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:columnCount="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/symbol"
android:text="@string/detail_symbol"
app:layout_columnWeight="1"
app:layout_rowWeight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/symbolValue"
app:layout_columnWeight="1"
app:layout_rowWeight="1"
tools:text="IBM" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/price"
android:text="@string/price"
app:layout_columnWeight="1"
app:layout_rowWeight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/priceValue"
app:layout_columnWeight="1"
app:layout_rowWeight="1"
tools:text="Price" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/percentage_change"
android:text="@string/percentage_change"
app:layout_columnWeight="1"
app:layout_rowWeight="1"
tools:text="Percentage change" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/percentageChangeValue"
app:layout_columnWeight="1"
app:layout_rowWeight="1"
tools:text=".09%" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/absolute_change"
android:text="@string/absolute_change"
app:layout_columnWeight="1"
app:layout_rowWeight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/absolutechangeValue"
app:layout_columnWeight="1"
app:layout_rowWeight="1"
tools:text="5.5" />
</android.support.v7.widget.GridLayout>
</LinearLayout>
</ScrollView>
答案 0 :(得分:0)
试试这个
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<com.github.mikephil.charting.charts.LineChart
android:id="@+id/line_chart"
android:layout_width="match_parent"
android:layout_height="300dp"></com.github.mikephil.charting.charts.LineChart>
<android.support.v7.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:columnCount="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/symbol"
android:text="@string/detail_symbol"
app:layout_columnWeight="1"
app:layout_rowWeight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/symbolValue"
app:layout_columnWeight="1"
app:layout_rowWeight="1"
tools:text="IBM" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/price"
android:text="@string/price"
app:layout_columnWeight="1"
app:layout_rowWeight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/priceValue"
app:layout_columnWeight="1"
app:layout_rowWeight="1"
tools:text="Price" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/percentage_change"
android:text="@string/percentage_change"
app:layout_columnWeight="1"
app:layout_rowWeight="1"
tools:text="Percentage change" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/percentageChangeValue"
app:layout_columnWeight="1"
app:layout_rowWeight="1"
tools:text=".09%" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/absolute_change"
android:text="@string/absolute_change"
app:layout_columnWeight="1"
app:layout_rowWeight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/absolutechangeValue"
app:layout_columnWeight="1"
app:layout_rowWeight="1"
tools:text="5.5" />
</android.support.v7.widget.GridLayout>
</LinearLayout>
</ScrollView>