android在水平滚动视图上绘制线条
您好,我已经发布了我的iphone应用程序Micro Pitch,现在将其移植到android上。我不知道如何在滚动视图中画线,我想知道我做错了什么 这是我的滚动视图界面的一部分android在水平滚动视图上绘制线条,android,drawing,scrollview,lines,Android,Drawing,Scrollview,Lines,您好,我已经发布了我的iphone应用程序Micro Pitch,现在将其移植到android上。我不知道如何在滚动视图中画线,我想知道我做错了什么 这是我的滚动视图界面的一部分 <HorizontalScrollView android:id="@+id/scroll_view" android:layout_above="@+id/btn_info" android:layout_alignParentTop="true" android:layout_height="match_pa
<HorizontalScrollView android:id="@+id/scroll_view" android:layout_above="@+id/btn_info" android:layout_alignParentTop="true" android:layout_height="match_parent" android:layout_width="match_parent" android:overScrollMode="always" android:layout_alignParentRight="true" android:layout_alignParentLeft="true">
<LinearLayout android:layout_height="match_parent" android:id="@+id/scroll_layout" android:layout_width="match_parent">
</LinearLayout>
</HorizontalScrollView>
这是我主要活动课的一部分
HorizontalScrollView scroll_view;
LinearLayout scroll_layout;
PlotView plot_view;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
scroll_view= (HorizontalScrollView)findViewById(R.id.scroll_view);
scroll_layout= (LinearLayout)findViewById(R.id.scroll_layout);
plot_view = new PlotView(this);
plot_view.setBackgroundColor(Color.WHITE);
scroll_layout.addView(plot_view);
}
plotview甚至没有显示在滚动视图上
<HorizontalScrollView android:id="@+id/scroll_view" android:layout_above="@+id/btn_info" android:layout_alignParentTop="true" android:layout_height="match_parent" android:layout_width="match_parent" android:overScrollMode="always" android:layout_alignParentRight="true" android:layout_alignParentLeft="true">
<LinearLayout android:layout_height="match_parent" android:id="@+id/scroll_layout" android:layout_width="match_parent">
</LinearLayout>
</HorizontalScrollView>
如果可能的话,请看一看我的iphone版本的免费应用程序。我这样做的目的是在滚动视图上绘制声音。这样,您就可以更好地了解我要做的事情。您的
PlotView
的大小为零,您需要实现以确定绘图所需的大小,如前所述
由于要通过代码将视图添加到
线性布局
。您的绘图视图
的大小为零,因此可能还需要为其设置一些。您需要根据说明确定绘图所需的大小
您可能还需要为它设置一些,因为您要通过代码将视图添加到线性布局中。我检查了此链接,我必须复制测量方法及其要求谢谢Zharfi检查了此链接,我必须复制测量方法及其要求谢谢Zharf