首页 > 其他 > 详细

[去广告]x米万能遥控 去掉底部banner广告

时间:2019-11-10 19:43:07      阅读:70      评论:0      收藏:0      [点我收藏+]

 

因为空调遥控器到处放 经常找不到遥控器 所以我下载了小米的遥控app
打开会在页面底部显示一个广告 看到广告我的第一反应就是  呵呵
 
技术分享图片

 

 

这里使用的工具是sdk自带的工具 uiautomatorviewer 用这个可以很方便的查看各种资源的id
当前思路是直接找到 ui引用的地方 删掉引用 (不成熟的一个想法)
 可以看到红包的图片id 是 banner_image
技术分享图片
图片右上角的x的资源id是 image_close_banner
 
接下来在ak全局搜索资源id 这里找到了4个引用的地方 
技术分享图片

 

 注释掉布局的xml文件和引用的部分

注释前xml的内容
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_gravity="center_horizontal" android:orientation="vertical" android:id="@id/layout_banner" android:layout_width="fill_parent" android:layout_height="fill_parent"
  xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
    <RelativeLayout android:layout_gravity="center_horizontal" android:background="@color/white_100_percent" android:layout_width="fill_parent" android:layout_height="@dimen/banner_height_group">
        <android.support.v7.widget.CardView android:layout_width="fill_parent" android:layout_height="@dimen/banner_height" android:layout_centerInParent="true" android:layout_marginStart="@dimen/banner_width_margin" android:layout_marginEnd="@dimen/banner_width_margin" app:cardCornerRadius="6.0dip" app:cardElevation="0.0dip">
            <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent">
                <ImageView android:id="@id/banner_image" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/default_poster_media" android:scaleType="fitXY" />
                <ImageView android:id="@id/image_close_banner" android:layout_width="40.0dip" android:layout_height="40.0dip" android:src="@drawable/close_banner" android:layout_alignParentTop="true" android:layout_alignParentRight="true" />
            </RelativeLayout>
        </android.support.v7.widget.CardView>
    </RelativeLayout>
</LinearLayout>

注释后

<item type="id" name="banner_image" />
    <item type="id" name="image_close_banner" /><?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_gravity="center_horizontal" android:orientation="vertical" android:id="@id/layout_banner" android:layout_width="fill_parent" android:layout_height="fill_parent"
  xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
    <RelativeLayout android:layout_gravity="center_horizontal" android:background="@color/white_100_percent" android:layout_width="fill_parent" android:layout_height="@dimen/banner_height_group">
        <android.support.v7.widget.CardView android:layout_width="fill_parent" android:layout_height="@dimen/banner_height" android:layout_centerInParent="true" android:layout_marginStart="@dimen/banner_width_margin" android:layout_marginEnd="@dimen/banner_width_margin" app:cardCornerRadius="6.0dip" app:cardElevation="0.0dip">
            <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent">
        </android.support.v7.widget.CardView>
    </RelativeLayout>
</LinearLayout>

可以看到只是删除了以下两句

<ImageView android:id="@id/banner_image" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/default_poster_media" android:scaleType="fitXY" />
<ImageView android:id="@id/image_close_banner" android:layout_width="40.0dip" android:layout_height="40.0dip" android:src="@drawable/close_banner" android:layout_alignParentTop="true" android:layout_alignParentRight="true" /> 
技术分享图片
 
其余3个也是简单粗暴的直接删除。 结果 编译直接报错,资源链接错误。

第二次尝试:
重新修改 这次只是删掉布局里的两行代码 修改运行  运行后发现崩溃秒退
想了想 直接删掉布局里的代码  后续代码引用到了这个地方 要显示图片的时候 也确实会引起一系列的错误
 

第三次尝试:
修改思路 更改布局的宽度和高度 如下
技术分享图片

 

 修改后结果如下 。 

技术分享图片
技术分享图片技术分享图片

 

这里还是修改的不够完善 上面有一片黑是因为当前区域没有 img填充 尝试把整个布局的宽高都改成0

技术分享图片

 

 bingo 成功撸掉了 banner广告

技术分享图片

 

 

[去广告]x米万能遥控 去掉底部banner广告

原文:https://www.cnblogs.com/shlyd/p/11831390.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!