Skip to content

Commit f39711d

Browse files
committed
content padding
1 parent 9a57660 commit f39711d

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

app/src/main/res/layout/activity_main.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
xmlns:tools="http://schemas.android.com/tools"
55
android:layout_width="match_parent"
66
android:layout_height="match_parent"
7+
android:background="#000000"
78
tools:context=".MainActivity">
89
<id.co.edtslib.swipebottomview.SwipeBottomView
910
android:id="@+id/swipeBottomView"
1011
app:title="@string/app_name"
12+
app:contentPadding="0dp"
1113
app:initialHeightPct="0.5"
1214
app:main="@layout/main"
1315
app:slide="@layout/slide"

swipebottomview/src/main/java/id/co/edtslib/swipebottomview/SwipeBottomView.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import android.widget.FrameLayout
77
import android.widget.TextView
88
import androidx.core.widget.TextViewCompat
99
import com.sothree.slidinguppanel.SlidingUpPanelLayout
10+
import androidx.constraintlayout.widget.ConstraintLayout
1011

1112
class SwipeBottomView: FrameLayout {
1213
var delegate: SwipeBottomDelegate? = null
@@ -101,6 +102,12 @@ class SwipeBottomView: FrameLayout {
101102
TextViewCompat.setTextAppearance(tvTitle, textStyle)
102103
}
103104

105+
val contentPadding = a.getDimension(R.styleable.SwipeBottomView_contentPadding, -1f)
106+
if (contentPadding >= 0) {
107+
val clContent = findViewById<ConstraintLayout>(R.id.clContent)
108+
clContent.setPadding(contentPadding.toInt(), clContent.paddingTop, contentPadding.toInt(), clContent.paddingBottom)
109+
}
110+
104111
initialHeightPct = a.getFloat(R.styleable.SwipeBottomView_initialHeightPct, 0.3f)
105112

106113
a.recycle()

swipebottomview/src/main/res/values/attrs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
<attr name="slide" format="reference" />
88
<attr name="bottom" format="reference" />
99
<attr name="initialHeightPct" format="float" />
10+
<attr name="contentPadding" format="dimension" />
1011
</declare-styleable>
1112
</resources>

0 commit comments

Comments
 (0)