在横向滚动视图上方添加文字(Android)
问题描述:
所以我想在水平滚动视图上方的屏幕上方显示一行文字。 基本上,文本的第一行将显示您所在的调音,并且在其下方将显示水平滚动条,并且在下面我将在图像中添加图像,我尝试了几个不同的东西,但所有这些东西似乎都是将水平滚动条推离屏幕。有关我如何做到这一点的任何建议? 这是迄今为止代码:在横向滚动视图上方添加文字(Android)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black">
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="none"
android:layout_gravity="center" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/near_black">
<Button
android:id="@+id/e_button"
android:text="@string/E"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10sp"
android:background="@null"
android:textSize="50sp"
android:textStyle="bold"
android:textColor="@color/white">
</Button>
,这样下去就用几个按钮,我关闭了之。 那么,我有什么建议,我可以做到这一点?
答
充分利用根LinearLayout
使用垂直方向:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/black">
然后在HorizontalScrollView
顶部应该工作增加了Textview
。
非常感谢!工作过一种享受! – AndyOHart 2013-03-16 21:32:24
不客气:-) – 2013-03-16 21:35:22