2019-07-03

Http.get("https://www.jianshu.com/p/8ca293691929",nil,nil,nil,function(code,content)

if code==200 then

--要浏览的网站

图片1=content:match("%【图片1→(.-)←%】")

图片2=content:match("%【图片2→(.-)←%】")

图片3=content:match("%【图片3→(.-)←%】")

图片4=content:match("%【图片4→(.-)←%】")

背景图=content:match("%【背景图→(.-)←%】")

shamrock=

{

    LinearLayout;

    orientation="vertical";

    layout_height="fill";

    layout_width="fill";

    Focusable=true,

    background=背景图;   

  {

    ScrollView,--纵向滚动

    layout_width='fill';--宽

    layout_height='fill';--高

    {

      LinearLayout;

      orientation="horizontal";

      Elevation="300dp";

      layout_width="fill";

      layout_height="100%h";

      {

        LinearLayout;

        orientation="vertical";

        layout_width="48%w";

        layout_height="fill";

        layout_marginLeft="2%w";

        --第一列

        {

          CardView;

          layout_gravity="center";

          layout_marginTop="23%h";

          elevation="0dp";

          layout_width="45%w";

          layout_height="45dp";

          cardBackgroundColor="#FFF7F7F7";

          radius="5dp";

          {

            LinearLayout;

            layout_margin="0dp";

            layout_width="fill";

            layout_height="fill";

            gravity="center";

            id="two";

            {

              TextView;

              textSize="14sp";

              text="全网影视",

              textColor="#333333";

            };

          };

        },

        {

          CardView;

          layout_gravity="center";

          layout_marginTop="2%h";

          elevation="0dp";

          layout_width="45%w";

          layout_height="45dp";

          cardBackgroundColor="#FFF7F7F7";

          radius="5dp";

          {

            LinearLayout;

            layout_margin="0dp";

            layout_width="fill";

            layout_height="fill";

            gravity="center";

            id="bird";

            {

              TextView;

              textSize="14sp";

              text="爱奇艺",

              textColor="#333333";

            };

          };

        },

        {

          CardView;

          layout_gravity="center";

          layout_marginTop="2%h";

          elevation="0dp";

          layout_width="45%w";

          layout_height="45dp";

          cardBackgroundColor="#FFF7F7F7";

          radius="5dp";

          {

            LinearLayout;

            layout_margin="0dp";

            layout_width="fill";

            layout_height="fill";

            gravity="center";

            id="needle";

            {

              TextView;

              textSize="14sp";

              text="芒果TV",

              textColor="#333333";

            };

          };

        },

        {

          CardView;

          layout_gravity="center";

          layout_marginTop="2%h";

          elevation="0dp";

          layout_width="45%w";

          layout_height="45dp";

          cardBackgroundColor="#FFF7F7F7";

          radius="5dp";

          {

            LinearLayout;

            layout_margin="0dp";

            layout_width="fill";

            layout_height="fill";

            gravity="center";

            id="line";

            {

              TextView;

              textSize="14sp";

              text="PPTV",

              textColor="#333333";

            };

          };

        },

        {

          CardView;

          layout_gravity="center";

          layout_marginTop="2%h";

          elevation="0dp";

          layout_width="45%w";

          layout_height="45dp";

          cardBackgroundColor="#FFF7F7F7";

          radius="5dp";

          {

            LinearLayout;

            layout_margin="0dp";

            layout_width="fill";

            layout_height="fill";

            gravity="center";

            id="Mary";

            {

              TextView;

              textSize="14sp";

              text="哔哩哔哩",

              textColor="#333333";

            };

          };

        },

        {

          CardView;

          layout_gravity="center";

          layout_marginTop="2%h";

          elevation="0dp";

          layout_width="45%w";

          layout_height="45dp";

          cardBackgroundColor="#FFF7F7F7";

          radius="5dp";

          {

            LinearLayout;

            layout_margin="0dp";

            layout_width="fill";

            layout_height="fill";

            gravity="center";

            id="white";

            {

              TextView;

              textSize="14sp";

              text="电视直播①",

              textColor="#333333";

            };

          };

        },

        {

          CardView;

          layout_gravity="center";

          layout_marginTop="2%h";

          elevation="0dp";

          layout_width="45%w";

          layout_height="45dp";

          cardBackgroundColor="#FFF7F7F7";

          radius="5dp";

          {

            LinearLayout;

            layout_margin="0dp";

            layout_width="fill";

            layout_height="fill";

            gravity="center";

            id="element";

            {

              TextView;

              textSize="14sp";

              text="收藏/历史记录",

              textColor="#333333";

            };

          };

        },

        --第二列

      };

      {

        LinearLayout;

        orientation="vertical";

        layout_width="48%w";

        layout_height="fill";

        layout_marginRight="2%w";

        {

          CardView;

          layout_gravity="center";

          layout_marginTop="23%h";

          elevation="0dp";

          layout_width="45%w";

          layout_height="45dp";

          cardBackgroundColor="#FFF7F7F7";

          radius="5dp";

          {

            LinearLayout;

            layout_margin="0dp";

            layout_width="fill";

            layout_height="fill";

            gravity="center";

            id="Thunder";

            {

              TextView;

              textSize="14sp";

              text="腾讯视频",

              textColor="#333333";

            };

          };

        },

        {

          CardView;

          layout_gravity="center";

          layout_marginTop="2%h";

          elevation="0dp";

          layout_width="45%w";

          layout_height="45dp";

          cardBackgroundColor="#FFF7F7F7";

          radius="5dp";

          {

            LinearLayout;

            layout_margin="0dp";

            layout_width="fill";

            layout_height="fill";

            gravity="center";

            id="bird2";

            {

              TextView;

              textSize="14sp";

              text="优酷视频",

              textColor="#333333";

            };

          };

        },

        {

          CardView;

          layout_gravity="center";

          layout_marginTop="2%h";

          elevation="0dp";

          layout_width="45%w";

          layout_height="45dp";

          cardBackgroundColor="#FFF7F7F7";

          radius="5dp";

          {

            LinearLayout;

            layout_margin="0dp";

            layout_width="fill";

            layout_height="fill";

            gravity="center";

            id="clever";

            {

              TextView;

              textSize="14sp";

              text="搜狐视频",

              textColor="#333333";

            };

          };

        },

        {

          CardView;

          layout_gravity="center";

          layout_marginTop="2%h";

          elevation="0dp";

          layout_width="45%w";

          layout_height="45dp";

          cardBackgroundColor="#FFF7F7F7";

          radius="5dp";

          {

            LinearLayout;

            layout_margin="0dp";

            layout_width="fill";

            layout_height="fill";

            gravity="center";

            id="close";

            {

              TextView;

              textSize="14sp";

              text="乐视视频",

              textColor="#333333";

            };

          };

        },

        {

          CardView;

          layout_gravity="center";

          layout_marginTop="2%h";

          elevation="0dp";

          layout_width="45%w";

          layout_height="45dp";

          cardBackgroundColor="#FFF7F7F7";

          radius="5dp";

          {

            LinearLayout;

            layout_margin="0dp";

            layout_width="fill";

            layout_height="fill";

            gravity="center";

            id="Rose";

            {

              TextView;

              textSize="14sp";

              text="娱乐直播",

              textColor="#333333";

            };

          };

        },

        {

          CardView;

          layout_gravity="center";

          layout_marginTop="2%h";

          elevation="0dp";

          layout_width="45%w";

          layout_height="45dp";

          cardBackgroundColor="#FFF7F7F7";

          radius="5dp";

          {

            LinearLayout;

            layout_margin="0dp";

            layout_width="fill";

            layout_height="fill";

            gravity="center";

            id="stone";

            {

              TextView;

              textSize="14sp";

              text="电视直播②",

              textColor="#333333";

            };

          };

        },

        {

          CardView;

          layout_gravity="center";

          layout_marginTop="2%h";

          elevation="0dp";

          layout_width="45%w";

          layout_height="45dp";

          cardBackgroundColor="#FFF7F7F7";

          radius="5dp";

          {

            LinearLayout;

            layout_margin="0dp";

            layout_width="fill";

            layout_height="fill";

            gravity="center";

            id="more";

            {

              TextView;

              textSize="14sp";

              text="关于软件",

              textColor="#333333";

            };

          };

        },

      };

    };

  };

};

webView.addView(loadlayout(shamrock))

--项目点击事件

two.onClick=function()

end

page=0

Thunder.onClick=function()

  弹出消息("消息内容2")

end

bird.onClick=function()

  弹出消息("消息内容3")

end

bird2.onClick=function()

  弹出消息("消息内容4")

end

needle.onClick=function()

  弹出消息("消息内容5")

end

clever.onClick=function()

  弹出消息("消息内容6")

end

line.onClick=function()

  弹出消息("消息内容7")

end

close.onClick=function()

  弹出消息("消息内容8")

end

Mary.onClick=function()

  弹出消息("消息内容9")

end

Rose.onClick=function()

  弹出消息("消息内容10")

end

white.onClick=function()

  弹出消息("消息内容11")

  end

stone.onClick=function()

弹出消息("消息内容12")

end

element.onClick=function()

弹出消息("消息内容13")

end

more.onClick=function()

弹出消息("消息内容14")

end

--波纹函数

function 波纹(id,颜色)

  import "android.content.res.ColorStateList"

  local attrsArray = {android.R.attr.selectableItemBackgroundBorderless}

  local typedArray =activity.obtainStyledAttributes(attrsArray)

  ripple=typedArray.getResourceId(0,0)                                       

  Pretend=activity.Resources.getDrawable(ripple)

  Pretend.setColor(ColorStateList(int[0].class{int{}},int{颜色}))

  id.setBackground(Pretend.setColor(ColorStateList(int[0].class{int{}},int{颜色})))end  sidebar.onLongClick=function()  this.startActivity(Intent(Intent.ACTION_VIEW,Uri.parse("mqqapi://card/show_pslcard?uin=97694694")))end

--用法

波纹(two,0xfff48FB1)

波纹(Thunder,0xfff48FB1)

波纹(bird,0xfff48FB1)

波纹(bird2,0xfff48FB1)

波纹(needle,0xfff48FB1)

波纹(clever,0xfff48FB1)

波纹(line,0xfff48FB1)

波纹(close,0xfff48FB1)

波纹(Mary,0xfff48FB1)

波纹(white,0xfff48FB1)

波纹(Rose,0xfff48FB1)

波纹(stone,0xfff48FB1)

波纹(element,0xfff48FB1)

波纹(more,0xfff48FB1)

YL=

{

RelativeLayout;

layout_width='fill';--布局宽度

layout_height='fill';--布局高度

{

LinearLayout;

layout_width='fill';--宽

layout_height='150dp';--高

{

PageView;

id="hd";

pages={

{

LinearLayout;

orientation='vertical';--重力属性

layout_width='fill';--布局宽度

layout_height='wrap';--布局高度

{

CardView;--卡片控件

layout_margin='10dp';--卡片边距

elevation='2dp';--阴影属性

layout_width='fill';--卡片宽度

layout_height='wrap';--卡片高度

radius='10dp';--卡片圆角

{

ImageView;--图片控件

src=图片1;--图片路径

layout_width='fill';--图片宽度

layout_height='wrap';--图片高度

scaleType='fitXY';--图片显示类型

onClick=function()

弹出消息("图片1")

  end

};

};

};

{

LinearLayout;

orientation='vertical';--重力属性

layout_width='fill';--布局宽度

layout_height='wrap';--布局高度

{

CardView;--卡片控件

layout_margin='10dp';--卡片边距

elevation='2dp';--阴影属性

layout_width='fill';--卡片宽度

layout_height='wrap';--卡片高度

radius='10dp';--卡片圆角

{

ImageView;--图片控件

src=图片2;--图片路径

layout_width='fill';--图片宽度

layout_height='wrap';--图片高度

scaleType='fitXY';--图片显示类型

onClick=function()

弹出消息("图片2")

end

};

};

};

{

LinearLayout;

orientation='vertical';--重力属性

layout_width='fill';--布局宽度

layout_height='wrap';--布局高度

{

CardView;--卡片控件

layout_margin='10dp';--卡片边距

elevation='2dp';--阴影属性

layout_width='fill';--卡片宽度

layout_height='wrap';--卡片高度

radius='10dp';--卡片圆角

{

ImageView;--图片控件

src=图片3;--图片路径

layout_width='fill';--图片宽度

layout_height='wrap';--图片高度

scaleType='fitXY';--图片显示类型

onClick=function()

弹出消息("图片3")

end

};

};

};

{

LinearLayout;

orientation='vertical';--重力属性

layout_width='fill';--布局宽度

layout_height='wrap';--布局高度

{

CardView;--卡片控件

layout_margin='10dp';--卡片边距

elevation='2dp';--阴影属性

layout_width='fill';--卡片宽度

layout_height='wrap';--卡片高度

radius='10dp';--卡片圆角

{

ImageView;--图片控件

src=图片4;--图片路径

layout_width='fill';--图片宽度

layout_height='wrap';--图片高度

scaleType='fitXY';--图片显示类型

onClick=function()

弹出消息("图片4")end

};

};

};

};

};

};

{

LinearLayout;

orientation='horizontal';--重力属性

layout_width='fill';--布局宽度

layout_height='wrap';--布局高度

layout_marginTop='110dp';--布局顶距

{

TextView;--文本控件

layout_width='fill';--文本宽度

layout_height='45dp';--文本高度

gravity='center';--重力属性

textColor='#FFFFFFFF';--文字颜色

text='';--显示的文字

textSize='8sp';--文字大小

id="ym1";

};

{

TextView;--文本控件

layout_width='5%w';--文本宽度

layout_height='45dp';--文本高度

gravity='center';--重力属性

textColor='#FFFFFFFF';--文字颜色

text='';--显示的文字

textSize='8sp';--文字大小

id="ym2";

};

{

TextView;--文本控件

layout_width='5%w';--文本宽度

layout_height='45dp';--文本高度

gravity='center';--重力属性

textColor='#FFFFFFFF';--文字颜色

text='';--显示的文字

textSize='8sp';--文字大小

id="ym3";

};

{

TextView;--文本控件

layout_width='5%w';--文本宽度

layout_height='45dp';--文本高度

gravity='center';--重力属性

textColor='#FFFFFFFF';--文字颜色

text='';--显示的文字

textSize='8sp';--文字大小

id="ym4";

};

};

};

webView.addView(loadlayout(YL))

hd.setOnPageChangeListener(PageView.OnPageChangeListener{

onPageScrolled=function(a,b,c)

if c==0 then

if a==0 then

ym1.setTextColor(0xFFFFFFFF) 

ym2.setTextColor(0x57FFFFFF) 

ym3.setTextColor(0x57FFFFFF) 

ym4.setTextColor(0x57FFFFFF)

task(5000,function()

hd.showPage(1)

end)

elseif a==1 then

ym1.setTextColor(0x57FFFFFF) 

ym2.setTextColor(0xFFFFFFFF) 

ym3.setTextColor(0x57FFFFFF) 

ym4.setTextColor(0x57FFFFFF)

task(5000,function()

hd.showPage(2)

end)

elseif a==2 then

ym1.setTextColor(0x57FFFFFF) 

ym2.setTextColor(0x57FFFFFF) 

ym3.setTextColor(0xFFFFFFFF) 

ym4.setTextColor(0x57FFFFFF)

task(3000,function()

hd.showPage(3)

end)

elseif a==3 then

ym1.setTextColor(0x57FFFFFF) 

ym2.setTextColor(0x57FFFFFF) 

ym3.setTextColor(0x57FFFFFF) 

ym4.setTextColor(0xFFFFFFFF)

task(3000,function()

hd.showPage(0)

end)

end

end

end})

 

else

print("网络好像不太好")

end

end)

--渐变色主题控制

import "android.graphics.drawable.GradientDrawable"

function 渐变(left_jb,right_jb,id)

drawable = GradientDrawable(GradientDrawable.Orientation.TR_BL,{

right_jb,--右色

left_jb,--左色

});

id.setBackgroundDrawable(drawable)

end

-- -----------调用渐变函数

渐变(0xFF2EC4B6,0xFFFF74EE,toolbarParent)

--程序启动时会执行的事件

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 1. css实现图片自适应宽高 2.讲 flex,手写出 flex 常用的属性,并且讲出作用 flex 是 fle...
    送你一堆小心心阅读 474评论 0 0
  • 公安三所对网络安全等级保护2.0要求解读网络安全等级保护制度已进入2.0阶段,在新阶段具有新的特征和新的落地标准支...
    溪边的墓志铭阅读 173评论 0 0
  • 你见,或者不见 我就在那里 不悲 不喜 你念,或者不念我 情就在那里 不来 不去 你爱,或者不爱我 爱就在那里 不...
    Humanni妮妮阅读 852评论 0 1
  • block基本语法: 声明:(返回类型)(^声明的block名称)(参数列表); 实现:返回值类型 (^block...
    一杯红酒mm阅读 711评论 0 0
  • 人的一生,能找到自己喜欢的事情是幸运的。有自己真兴趣的人,才会生活得有趣,才可能成为一个有意思的人。当你不计功利地...
    秀琴sukin阅读 315评论 1 6

友情链接更多精彩内容