Java 在滚动视图中折叠图表
我是新的Andriod开发者,我尝试使用滚动视图,里面有一个线性布局。线性布局在运行时被视图填充。该视图用于创建图表。问题是我画的图表在打开的页面上被折叠了这里是我得到的图表xmlJava 在滚动视图中折叠图表,java,c#,android,xamarin,Java,C#,Android,Xamarin,我是新的Andriod开发者,我尝试使用滚动视图,里面有一个线性布局。线性布局在运行时被视图填充。该视图用于创建图表。问题是我画的图表在打开的页面上被折叠了这里是我得到的图表xml <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:minWidth="25px" android:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/scrollView1">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="750px"
android:id="@+id/linearLayout_ParentScroll">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="100px"
android:minHeight="100px"
android:id="@+id/linearLayout_ScrollChart" />
</LinearLayout>
</ScrollView>
下面是我的活动onCreate方法
SetContentView(Resource.Layout.ScrollableChart);
LinearLayout laout = FindViewById<LinearLayout>(Resource.Id.linearLayout_ScrollChart);
int[] values = { 700, 400, 100, 500, 600 };
Color[] color_values = { Color.Magenta, Color.Red, Color.Green, Color.Blue, Color.Yellow, Color.Cyan };
String[] itemnames = { "item 1", "item 2", "item 3", "item 4", "item 5", "item 6" };
ExtendedPieChart chart = new ExtendedPieChart(this, itemnames, values, color_values);
laout.AddView(chart);
laout.SetBackgroundColor(Color.WhiteSmoke);
有人能帮我弄清楚吗
注意:我没有足够的声誉来发布图片来更好地解释这个问题。尝试在scrollview和linear layout中设置android:layout\u height以匹配父对象。如果我将android:layout\u height设置为匹配父对象,我将看不到图形。您也可以发布您的expendedpiechart类吗?xml没有问题。它应该正确地包装它的内容。您可以在添加视图后尝试laout.Invalidate