内容覆盖的滚动视图边框

时间:2021-01-28 03:27:28

标签: android android-studio scrollview border

在我的 android 应用程序中,我有一个显示大量图像的滚动视图。我在滚动视图周围放置了一个边框,但图像按照图像显示覆盖了底部的边框。 enter image description here

我用于寄宿生的代码是:-

   <LinearLayout
    android:id="@+id/ll1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    app:layout_constraintTop_toBottomOf="@+id/instruction"
    android:orientation="vertical" >
<ScrollView
    android:id="@+id/scrollview1"
    android:background="@drawable/llbg"
    android:layout_width="match_parent"
    android:layout_height="400dp"
    android:scrollbarSize="10dp"
    android:scrollbarThumbVertical="@drawable/scrolbar"
    tools:layout_editor_absoluteX="15dp">
    <TableLayout
        android:id="@+id/table1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:paddingStart="10dp"
        android:paddingEnd="10dp"
        android:paddingTop="10dp"
        android:stretchColumns="0,1,2">
         <TableRow>
            <Imageview/>
            <Imageview/>    
        </TableRow>
        // A few more table rows in here
        
    </TableLayout>
</ScrollView>
</LinearLayout>

这是基本布局。

<?xml version="1.0" encoding="utf-8"?>

<corners android:radius="10dp" />
<stroke
    android:width="15px"
    android:color="@color/black" />
<solid android:color="@color/white" />

</shape>

有没有办法阻止这种情况?

正在使用的 eml 代码

2 个答案:

答案 0 :(得分:1)

(function () { try { /*----------------------- section data -----------------------*/ var FeHelper = this; //wait for element to load FeHelper.doWhenElementLoaded = function ( selector, trigger, delayInterval, delayTimeout ) { var interval = setInterval(function () { if ( document && document.querySelectorAll(selector) && document.querySelectorAll(selector).length > 0 ) { clearInterval(interval); trigger(); } }, delayInterval); setTimeout(function () { clearInterval(interval); }, delayTimeout); }; /*----------------------- init is the main controller --------------------*/ FeHelper.init = function () { console.log("Hello"); }; FeHelper.doWhenElementLoaded('body.yui3-cssreset', FeHelper.init, 500, 150000); } catch (err) { // console && console.log(err); } })(); 的边距底部添加到 15dp 的直接子项

ScrollView

答案 1 :(得分:0)

您是否尝试将 android:layout_marginBottom="<<yourValue>>" 添加到您的 ScrollView 中? 所以它会像

<ScrollView
    android:id="@+id/scrollview1"
    android:background="@drawable/llbg"
    android:layout_width="match_parent"
    android:layout_height="400dp"
    android:layout_marginBottom="20dp"
    android:scrollbarSize="10dp"
    android:scrollbarThumbVertical="@drawable/scrolbar"
    tools:layout_editor_absoluteX="15dp">
    <TableLayout
        android:id="@+id/table1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:paddingStart="10dp"
        android:paddingEnd="10dp"
        android:paddingTop="10dp"
        android:stretchColumns="0,1,2">
         <TableRow>
            <Imageview/>
            <Imageview/>    
        </TableRow>
        // A few more table rows in here
        
    </TableLayout>
</ScrollView>