# WrapContentableSwipeRefreshLayout
SwipeRefreshLayout with wrap_content available for properties of child View
<br/>
## Greetings
Hi developers.
As many android developers know,<br/>
android.support.v4.widget.SwipeRefreshLayout does not allow<br/>
the WrapContent attribute on child views.
However, we need to use the property in the SwipeRefreshLayout<br/>
when we implement the UI according to the designers' demand.
This layout was made for such a case.
## Difference from SwipeRefreshLayout
#### SwipeRefreshLayout
```xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#333333"
>
<android.support.v4.widget.SwipeRefreshLayout
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FF0000"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:background="#0000FF"
>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="2dp"
android:background="#AAAAAA"
>
<TextView
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="row 1"
android:textSize="12dp"
android:textColor="#333333"
/>
</FrameLayout>
...
</LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>
```
![Preview](https://github.com/gchulsong/WrapContentableSwipeRefreshLayout/blob/master/screenshot/asis_preview_new.png)
#### WrapContentableSwipeRefreshLayout
```xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#333333"
>
<com.gchulsong.wrapcontentableswiperefreshlayout.WrapContentableSwipeRefreshLayout
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FF0000"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:background="#0000FF"
>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="2dp"
android:background="#AAAAAA"
>
<TextView
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="row 1"
android:textSize="12dp"
android:textColor="#333333"
/>
</FrameLayout>
...
</LinearLayout>
</com.gchulsong.wrapcontentableswiperefreshlayout.WrapContentableSwipeRefreshLayout>
</FrameLayout>
```
![Preview](https://github.com/gchulsong/WrapContentableSwipeRefreshLayout/blob/master/screenshot/tobe_preview_new.png)
## Usage
This layout uses the code from SwipeRefreshLayout,<br/>
so you can use all the features of SwipeRefreshLayout 100% equally.<br/>
So, usage is no different from SwipeRefreshLayout.
[SwipeRefreshLayout](https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html)
As shown in the picture below, any view such as ScrollView, ListView,<br/>
and RecyclerView works well for child view.<br/>
If there are parts that do not work well, please fix them by using PR.
ScrollView | ListView | RecylerView
-----------|----------|------------
![ScrollView example](https://github.com/gchulsong/WrapContentableSwipeRefreshLayout/blob/master/screenshot/example_scrollview.gif)|![ListView example](https://github.com/gchulsong/WrapContentableSwipeRefreshLayout/blob/master/screenshot/example_listview.gif)|![RecyclerView example](https://github.com/gchulsong/WrapContentableSwipeRefreshLayout/blob/master/screenshot/example_recyclerview.gif)
You can scroll inside by adding a view that can limit the maximum height<br/>
as a child of WrapContentableSwipeRefreshLayout.
## Gradle
```
dependencies {
implementation 'com.gchulsong.widget:wrapcontentableswiperefreshlayout:1.0.0'
}
```
## Practice
The following figure shows this layout in Prism Live Studio,<br/>
an app I am participating in as a developer.<br/>
[PRISM Live Studio](https://play.google.com/store/apps/details?id=com.prism.live)
![PrismLiveStudio](https://github.com/gchulsong/WrapContentableSwipeRefreshLayout/blob/master/screenshot/example_prism.gif)
It's a dope live broadcast tool and I hope you will use it a lot.
Thank you,<br/>
Jake.
## License
```
------------------------------------------------------------
"THE BEERWARE LICENSE" (Revision 1):
gchulsong wrote this code. As long as you retain
this notice, you can do whatever you want with this stuff.
If we meet someday, and you think this stuff is worth it,
you can buy me a beer in return.
------------------------------------------------------------
```
没有合适的资源?快使用搜索试试~ 我知道了~
WrapContentableSwipeRefreshLayout:带有wrap_content的SwipeRefreshLay...
共64个文件
xml:21个
png:14个
java:6个
需积分: 10 1 下载量 105 浏览量
2021-05-16
09:38:04
上传
评论
收藏 10.38MB ZIP 举报
温馨提示
WrapContentableSwipeRefreshLayout 带有wrap_content的SwipeRefreshLayout可用于子级View的属性 问候 嗨,开发人员。 许多Android开发人员都知道, android.support.v4.widget.SwipeRefreshLayout不允许子视图上的WrapContent属性。 但是,我们需要在SwipeRefreshLayout中使用该属性当我们根据设计师的需求实现UI时。 这种布局是为这种情况而设计的。 与SwipeRefreshLayout的区别 滑动刷新布局 <? xml version = " 1.0 " encoding = " utf-8 " ?> < FrameLayout xmlns : android = " http://schemas.android.com/apk/res/an
资源详情
资源评论
资源推荐
收起资源包目录
WrapContentableSwipeRefreshLayout-master.zip (64个子文件)
WrapContentableSwipeRefreshLayout-master
screenshot
example_listview.gif 228KB
asis_preview_new.png 10KB
example_scrollview.gif 269KB
example_prism.gif 9.59MB
tobe_preview_new.png 9KB
example_recyclerview.gif 241KB
gradlew.bat 2KB
gradlew 5KB
gradle.properties 730B
wrapcontentableswiperefreshlayout
proguard-rules.pro 751B
src
test
java
com
gchulsong
wrapcontentableswiperefreshlayout
ExampleUnitTest.java 425B
androidTest
java
com
gchulsong
wrapcontentableswiperefreshlayout
ExampleInstrumentedTest.java 800B
main
res
values
strings.xml 96B
java
com
gchulsong
wrapcontentableswiperefreshlayout
WrapContentableSwipeRefreshLayout.java 45KB
WrapContentableCircleImageView.java 5KB
AndroidManifest.xml 139B
.gitignore 7B
build.gradle 2KB
app
proguard-rules.pro 751B
src
test
java
com
gchulsong
wrapcontentableswiperefreshlayout
ExampleUnitTest.java 425B
androidTest
java
com
gchulsong
wrapcontentableswiperefreshlayout
ExampleInstrumentedTest.java 795B
main
res
mipmap-xxxhdpi
ic_launcher.png 9KB
ic_launcher_round.png 15KB
drawable-xhdpi
ic_chevron_left_white_36dp.png 169B
ic_chevron_left_white_24dp.png 136B
drawable
bg_module.xml 381B
ic_launcher_background.xml 5KB
mipmap-hdpi
ic_launcher.png 3KB
ic_launcher_round.png 5KB
values
colors.xml 264B
strings.xml 96B
styles.xml 383B
mipmap-xxhdpi
ic_launcher.png 6KB
ic_launcher_round.png 10KB
mipmap-mdpi
ic_launcher.png 2KB
ic_launcher_round.png 3KB
mipmap-xhdpi
ic_launcher.png 4KB
ic_launcher_round.png 7KB
anim
view_enter_from_bottom.xml 596B
layout
activity_example_scrollview.xml 3KB
activity_main.xml 2KB
activity_example_listview.xml 3KB
activity_example_recyclerview.xml 3KB
test.xml 3KB
view_adapterview_item.xml 829B
java
com
gchulsong
example
wrapcontentableswiperefreshlayout
example
ListViewActivity.kt 2KB
ScrollViewActivity.kt 2KB
RecyclerViewActivity.kt 3KB
MainActivity.kt 1KB
AndroidManifest.xml 1KB
.gitignore 7B
build.gradle 1KB
gradle
wrapper
gradle-wrapper.jar 52KB
gradle-wrapper.properties 230B
.idea
gradle.xml 705B
runConfigurations.xml 564B
misc.xml 2KB
modules.xml 620B
dictionaries
Naver.xml 84B
encodings.xml 159B
.gitignore 88B
README.md 6KB
settings.gradle 53B
build.gradle 697B
共 64 条
- 1
MorisatoGeimato
- 粉丝: 46
- 资源: 4664
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0