分类目录归档:android

android java gzip解压

    public String decompress(byte[] compressed) throws IOException {
        final int BUFFER_SIZE = 32;
        ByteArrayInputStream is = new ByteArrayInputStream(compressed);
        GZIPInputStream gis = new GZIPInputStream(is, BUFFER_SIZE);
        StringBuilder string = new StringBuilder();
        byte[] data = new byte[BUFFER_SIZE];
        int bytesRead;
        while ((bytesRead = gis.read(data)) != -1) {
            string.append(new String(data, 0, bytesRead));
        }
        gis.close();
        is.close();
        return string.toString();
    }

// 解压
           String cc = "H4sIAAAAAAAAA3s6ddlTVAQAXAODIhIAAAA=";
           try {
               this.decryptedText.setText(this.decompress(Base64.decode(cc.toCharArray())));
           } catch (IOException e) {
               e.printStackTrace();
           }

scrollView.setOnScrollChangeListener

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    scrollView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
        @Override
        public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
            Log.i("iTag.scrollY", String.valueOf(scrollY));
            Log.i("iTag.oldScrollY", String.valueOf(oldScrollY));
            if (scrollY < 0 && oldScrollY < 0) {
                textView.setText("");
                doGet();
            }
        }
    });
}

android去除标题栏

跟踪

android:theme="@style/AppTheme"

进入修改style.xml文件,这里还可以修改颜色,还可以全屏

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
        <!-- Customize your theme here. -->
        <!--<item name="colorPrimary">@color/colorPrimary</item>-->
        <!--<item name="colorPrimaryDark">@color/colorPrimaryDark</item>-->
        <!--<item name="colorAccent">@color/colorAccent</item>-->
        <item name="android:windowFullscreen">true</item>
    </style>

</resources>