登录  | 立即注册

游客您好!登录后享受更多精彩

查看: 1462|回复: 1

[lua教程] 【lua教程】MD关于界面

[复制链接]

444

主题

509

帖子

2051

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
2051

荣誉管理论坛元老

发表于 2021-7-1 08:39:31 来自手机 | 显示全部楼层 |阅读模式 来自:
  1. require "import"8 w3 y: Z6 S; m
  2. import "android.app.*"
    , k7 k$ K0 A* {) V8 ]
  3. import "android.os.*"  Q; ~' |2 ^; L; c" C/ y' ?0 p
  4. import "android.widget.*"4 B/ h, ]  `0 Y
  5. import "android.view.*". p. m5 L- ~: i3 S* p6 l# W
  6. import"android.text.*"
    # f' ?8 q0 p5 {* u% u
  7. import "android.graphics.drawable.*", r2 @$ y/ h' S
  8. 5 a6 r* k) {% G, J
  9. --作者QQ2830376751- v1 T# I8 ~4 U8 X$ E8 m
  10. activity.setTitle('关于')# s& {9 A! ]; ~% _2 Z$ Z, [
  11. : ]7 x  \1 m8 ]& Y
  12. local Theme_Color=tointeger(0xFF3F51B5)6 C& g7 [& o0 V. V1 l: F' C3 n9 |

  13. 0 K) _9 h  x3 }/ H0 E8 r' d% d
  14. activity.setTheme(android.R.style.Theme_DeviceDefault_Light_DarkActionBar)4 ]2 g2 q  B/ z4 F; e7 a. U; |
  15. activity.ActionBar.show()- }" \% f( h7 T% q: y/ V. N+ _3 Q8 X
  16. activity.ActionBar.setBackgroundDrawable(ColorDrawable(Theme_Color))
    ' `, _' v1 j1 U& ^9 W0 I
  17. activity.getWindow().setStatusBarColor(0xFF303F9F);
    6 `5 B# D- }! h( ^8 F
  18. activity.getActionBar().setDisplayHomeAsUpEnabled(true)
    ) S# g9 x/ h) w5 h( k# ?" I3 F' Y, O  ^

  19. 4 U/ L4 h+ j8 b2 s  P- h  c
  20. function onMenuItemSelected(id,title)) ]8 L* r9 @- \# o
  21.   activity.finish()
    / \8 ~' D5 D: X& B- p, e, h
  22. end
    + Q9 t: W% ~- L5 G, L, l; A

  23. ' P+ V" z+ H. o) k

  24. 9 ]0 u4 t7 m7 D. w/ m7 F
  25. shamrock=) Y, t5 ]: n' R* H5 ^
  26. {
    " ?- Y" X/ `8 w$ `) W! H
  27.   LinearLayout;
    1 \6 v1 t4 B! D; m9 G+ Y
  28.   Orientation='vertical';" W& K5 }0 t/ A8 W* N
  29.   layout_width='fill';
    6 C" q+ {" v2 L* ]
  30.   layout_height='fill';
    & z* |9 N/ ]/ Y% K0 X4 U# W
  31.   {4 d! K( D, `) \8 o; D
  32.     ListView;
    3 t% O( \! U& j* u$ s1 S
  33.     id="listView";% G1 i9 X5 Y9 h5 [6 ]  j
  34.     DividerHeight="0dp";) p4 c# q0 j$ @' ]$ Q: m
  35.     layout_gravity="center";5 s1 j$ h9 Q! [. x+ m  z, \
  36.     layout_width="-1";
    + v( O/ [0 J: }2 z6 }
  37.     layout_height="-1";
    ) c3 B% Y$ e. N3 b& e& b7 \
  38.   };
    4 G0 i. X, y) P$ e
  39. };& ]( d: M' m; r" v
  40. activity.setContentView(loadlayout(shamrock))2 K8 W' X2 w# J+ R1 T/ n* z8 r+ k

  41. , c1 |; _$ `  t9 e1 \
  42. % j6 E: x* `& ?2 X' o1 j+ c" G% r
  43. 7 w( s) U- r7 `) ^
  44. data = {}8 _* \! b/ R( {7 P) Y

  45. , T0 L- m- n$ n* W6 d- ?
  46. setting=6 ]! x5 v$ u" e, B; S. Q. b
  47. {1 ~$ x" n- W' V4 H' s2 c; \
  48.   {--1, j; s& z# m9 \
  49.     LinearLayout;
    6 c9 b, u( S& I9 \' |
  50.     gravity="center";/ H+ x  h+ U3 I8 R- k
  51.     layout_width="fill";5 o4 x7 y: m, `' [# g
  52.     layout_height="75dp";- f6 ]* ^# H3 U) E* B$ a3 [/ ^. l
  53.     {
    0 z. H1 R9 [3 `1 Y
  54.       LinearLayout;+ Y' h! d7 S6 W3 f6 ?, L/ N
  55.       orientation="vertical";
    5 d) C/ [& n! d. v
  56.       layout_height="fill";
    & X. L# s. d4 C% Q
  57.       gravity="center_vertical";
    6 V2 ?1 p3 _4 z/ T# \1 R, T7 ]- X5 H
  58.       layout_weight="1";4 [6 S: d6 M/ C: B. m
  59.       {; V8 v; ?  h1 Z. P9 O# f0 C
  60.         TextView;% _0 c; p- e' j# n
  61.         layout_marginLeft="15dp";1 z! u5 Q, h$ ^8 S
  62.         textSize="16sp";
    4 H0 L" W9 r8 X9 j' K) V
  63.         textColor=0xff000000;
    , s, p+ s7 V; m( `5 m
  64.         id="subtitle";
    5 d4 i' f  e) A
  65.       };
    : x: M2 G; }# T" @! U
  66.       {
    $ n5 ?" q2 ~+ `" a  `
  67.         TextView;3 V" A8 T2 g2 s: d
  68.         id="message";
    1 I2 A+ f' d( l& h
  69.         textSize="15sp";
    % L' X; h% p" e6 Q2 g) j. l! h0 e
  70.         layout_marginLeft="15dp";$ A8 o9 x6 C- W; O8 R0 w
  71.       };
    ! I( F+ R( d! S( [5 j- \
  72.     };1 R6 ^2 o- j, r  O
  73.   };- J- F+ V$ Y5 R; b: a
  74.   {--2
      S1 ?& n" \  U' @% N0 K
  75.     LinearLayout;
    , Q: z) \" F7 z2 E" F& P. C
  76.     layout_height="1dp";
    + z: M7 q6 Q) N( z9 [- j9 h
  77.     backgroundColor=0xFFE0E0E0;. o; d9 G) a7 g1 y  ]' v
  78.     layout_width="fill";* |# y- y: f/ r- X* z, u7 {
  79.   };- h( f1 w, `+ F) J' W# C$ G7 f
  80.   {--38 f! \* q9 o+ W, s9 R
  81.     LinearLayout;0 j( k5 K7 h+ ^, l, R: F. s
  82.     gravity="center";
    , Y& M4 T4 X. t4 X1 A* i
  83.     layout_width="fill";' B$ R9 K7 @. s! B* V" B* s) x- ]
  84.     layout_height="55dp";5 F  E# z" c% j
  85.     {, e* @# x* W# r3 b1 h* I
  86.       LinearLayout;: ~; ~+ r' _/ w/ h2 R9 `" ^4 P
  87.       orientation="vertical";* N& y4 n2 K8 m. @/ Y
  88.       layout_height="fill";) U6 C: @* L3 k- \" Q  X
  89.       gravity="center_vertical";
    , \& f7 N' @1 c" z
  90.       layout_weight="1";
    * Q+ l- x& G" [/ _( |* |9 }1 i* K
  91.       {
    $ _- H) G' d' A
  92.         TextView;) b. N/ l) t8 y' g& Q4 R
  93.         layout_marginLeft="15dp";
    & z; l" N: T% |+ @7 x0 @. z' ~
  94.         textSize="16sp";5 k. {6 y: Q9 V1 s. {
  95.         textColor=0xff000000;1 k1 Q. {! Q/ ~8 u
  96.         id="subtitle";0 r4 X0 k8 O+ B5 r3 b# C* l7 G. a
  97.       };1 Z, r! x* ^1 x% S* |# V/ A
  98.     };
    0 A8 F* E/ ?! I* g$ z
  99.   };( H# s% Y3 U1 h) l% R9 W
  100. };! i/ g% q7 i7 ~9 H/ r# O
  101. adp=LuaMultiAdapter(this,data,setting)
    $ I4 C* G" c3 Z3 V& a: f9 B+ P# P

  102. + A  n- _& I- q& w1 p! o+ @

  103. + r$ T: d/ `  R9 }- n' B
  104. adp.add{__type=1,subtitle="App v1.0.1",message="Copyright © 2021 Android Does"}) h. M" x* @: o; F% J
  105. adp.add{__type=2}, R9 |; n  @) C, F) Y( g  X. S$ e
  106. adp.add{__type=1,subtitle="帮助",message="常见问题解答"}
    9 Z2 B& u# P& \( w& Y
  107. adp.add{__type=2}; k; W9 U- `; i* l1 ?
  108. adp.add{__type=3,subtitle="表达感谢"}
    # l* a- W, N, |2 Y! n& R1 `" {. |
  109. adp.add{__type=2}* Q6 i+ P( f# w) L
  110. listView.setAdapter(adp)
    ; |4 q7 z: H9 E2 l+ j

  111. 0 d& K1 D+ X5 L5 c6 {
  112. 5 i8 @" n1 Q$ q6 z3 u2 L3 Q
  113. listView.setOnItemClickListener(AdapterView.OnItemClickListener{
    4 b* X. j8 x9 ?5 {1 G7 }
  114.   onItemClick=function(id,v,zero,one)
    ( X% ^* P% b6 }5 Q) Y1 m* T
  115.     if v.Tag.subtitle.Text==nil
    : x. C* c" V* P4 c
  116.      else/ d9 M3 f; y) f" [( ]
  117.       if v.Tag.subtitle.Text=="帮助", u1 _& C# `# r. j# |! W5 A* s
  118.         print( v.Tag.subtitle.Text)! _) ^: d: x2 \0 h
  119.        elseif v.Tag.subtitle.Text=="表达感谢"0 T# y/ U, j4 ]5 C5 C* [
  120.         print( v.Tag.subtitle.Text)" S9 t5 x- }, a+ t( K2 }0 E
  121.       end% H4 `/ B5 T  a
  122.     end
    & d  y3 d2 z1 E
  123.   end, Z) j7 M0 w: I+ N, v3 L& V
  124. })
复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|星空社区 |网站地图

GMT+8, 2024-4-25 21:34 , Processed in 0.049203 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表