<!--网络连接-->
<uses-permission android:name="android.permission.INTERNET"/>
<!--网络权限-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
apache依赖类 在build.gradle下加入此代码
useLibrary 'org.apache.http.legacy'
在gradle.properties下加入此代码解决新建模块时布局文件无法快捷代码
android.enableAapt2=false;
在build.gradle下加入此代码
TabLayout的依赖库
implementation 'com.android.support:design:26.+'
PullToRefreshScrollView的依赖库
compile 'com.github.userswlwork:pull-to-refresh:1.0.0'
TabLayout布局文件中添加布局效果代码:
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="50dp"
app:tabGravity="center"
app:tabIndicatorColor="#fff"
app:tabMode="scrollable"
app:tabSelectedTextColor="#f89"
app:tabTextColor="@color/colorPrimary">
</android.support.design.widget.TabLayout>
自定义ListView/GridView需创建一个类,继承ListView/GridView,重写前3个方法,手写以下方法
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
//重新计算高度
int newHeight=MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE>>2,MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, newHeight);
}
ImageLoader报错:首先查看清单文件是否配置name