0
在我的Android代码中,我创建了一个图形。但是在两种不同的设备中,“match_parent”并不像应该那样。不同的屏幕尺寸变化查看Android
这是company_header.xml
<RelativeLayout
android:id="@+id/rlForScreenShot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
*<com.kite.chart.chart.ChartView
android:id="@+id/cvChart"
android:layout_width="match_parent"
android:layout_height="200dp" />*
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/tvCompanyName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Loading" />
<TextView
android:id="@+id/tvCompanyPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="Loading" />
<TextView
android:id="@+id/tvCompanyChange"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="Loading" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
当在谷歌Nexus 10上运行有和图形中没有空间在它下面的细节部分。
当它在Samsung Galaxy note3上运行时。图表中有一个空格,下面是详细信息。
当我更改android:layout_height = match_parent时,对于这两个屏幕设备图都消失。我认为这应该可以解决这个问题,因为在我的Android Manifest.xml中,我已经使用了所有屏幕大小。
*<com.kite.chart.chart.ChartView
android:id="@+id/cvChart"
android:layout_width="match_parent"
**android:layout_height="match_parent**" />*
感谢您的帮助。或者有无论如何,我可以解决这个使用CSS? Kingsley PS:我需要10个声望才能发布图片,因此为什么不附上图片。
我不知道你这个答案。你能否详细解释一下,或者一个例子会有帮助。 – 2014-09-30 14:08:23
我编辑一个示例代码,将帮助你,如果你没有得到我的答案,请填写免费查询。 – Lokesh 2014-10-01 05:52:05
现在看来这是唯一的选择,因为当我绘制后调试并检查chartview的高度时,它仍然显示为空。所以它似乎必须给定一个确定的高度才能正确显示。 – 2014-10-02 03:01:42