我的問題是,如果有一種方法可以在ScrollView
周圍放置一個簡單的黑線邊框,以便用戶確切知道ScrollView
開始,停止和它的寬度。我無法在Android文檔中找到任何類型的XML或Java代碼來說明如何執行此操作。我知道這一定是可能的。把滾動視圖周圍的黑線邊框 - Android
以下是我的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>
下面的截圖就是它產生:
這不是完全是我想要的。我想要一個很窄的黑線,而不是一個黑匣子。
當然,如果您想要黑色邊框,請用邊距替換marginTop和marginBottom。 – 2013-02-19 16:20:25
我有一個背景圖片,用於我想要保留並顯示在ScrollView中的整個活動。請看我編輯的開幕帖子。 – Matt 2013-02-20 12:53:18
我已更新我的回答 – 2013-02-20 13:34:29