我的问题是,是否有办法在 ScrollView
周围放置一个简单的黑线边框,以便用户准确了解 ScrollView
的开始、停止位置以及它的宽度是。我在 Android 文档中找不到任何类型的 XML 或 Java 代码来说明如何执行此操作。我知道这一定是可能的。
下面是我的 ScrollView
的 XML 代码,我需要有一个边框。
<LinearLayout
.... />
<TextView
... />
//BORDER STARTS HERE
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="94.5"
android:paddingBottom="5dp"
android:fillViewport="true" >
<LinearLayout
... >
<TextView
... />
</LinearLayout>
</ScrollView>
//BORDER ENDS HERE
<Button
... />
</LinearLayout>
编辑
我刚刚用下面的代码添加了一个scrollviewborder.xml
作为ScrollView
的背景。
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="2dp"
android:color="#000000"/>
</shape>
下面的截图是它产生的:
这不是我想要的。我想要一条细黑线,而不是黑框。
最佳答案
根据您的新要求,尝试以下代码:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@android:color/transparent"/>
<stroke
android:width="2dp"
android:color="#000000"/>
</shape>
关于java - 在 ScrollView 周围放置黑线边框 - Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14962036/