提交 33f8158a 编写于 作者: 门心叼龙's avatar 门心叼龙

code perfect

上级 7e9a2250
......@@ -9,6 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".PinnedHeaderActivity">
</activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
......
......@@ -19,6 +19,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
private Button mBtnStickyLayout;
private Button mBtnScrollView;
private Button mBtnPinnedHeader;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -26,11 +27,11 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
setContentView(R.layout.activity_main);
mBtnStickyLayout = findViewById(R.id.btn_sticky_layout);
mBtnScrollView = findViewById(R.id.btn_scroll_view);
mBtnPinnedHeader = findViewById(R.id.btn_pinned_header);
mBtnStickyLayout.setOnClickListener(this);
mBtnScrollView.setOnClickListener(this);
HorizontalScrollView scrollView;
NestedScrollView h;
mBtnPinnedHeader.setOnClickListener(this);
}
......@@ -43,6 +44,9 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
case R.id.btn_scroll_view:
startActivity(new Intent(this, HorizontalScrollViewActivity.class));
break;
case R.id.btn_pinned_header:
startActivity(new Intent(this,PinnedHeaderActivity.class));
break;
}
}
}
package com.mxdl.customview;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.mxdl.customview.adapter.ExpandableListViewAdapter;
import com.mxdl.customview.view.PinnedHeaderExpandableListView;
/**
* Description: <PinnedHeaderActivity><br>
* Author: mxdl<br>
* Date: 2019/10/10<br>
* Version: V1.0.0<br>
* Update: <br>
*/
public class PinnedHeaderActivity extends AppCompatActivity {
private PinnedHeaderExpandableListView mExpandableListView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pinned_header);
mExpandableListView = findViewById(R.id.view_expand_listview);
mExpandableListView.setAdapter(new ExpandableListViewAdapter(this));
for(int i = 0; i < 3; i++){
mExpandableListView.expandGroup(i);
}
mExpandableListView.showPinnedHeaderView();
}
}
......@@ -7,18 +7,26 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/btn_sticky_layout"
android:id="@+id/btn_scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="StickyLayout"
android:text="HorizontalScrollView"
android:textAllCaps="false"
/>
<Button
android:id="@+id/btn_scroll_view"
android:id="@+id/btn_pinned_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="HorizontalScrollView"
android:text="PinnedHeaderExpandableListView"
android:textAllCaps="false"
/>
<Button
android:id="@+id/btn_sticky_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="StickyLayout"
android:textAllCaps="false"
/>
</LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sticky_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.mxdl.customview.view.PinnedHeaderExpandableListView
android:id="@+id/view_expand_listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册