实现效果:
代码:
布局文件:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#F3F3F3" android:orientation="vertical"> <LinearLayout android:id="@+id/ll_top_split" android:layout_width="match_parent" android:layout_height="17dp" android:layout_marginTop="10dp" android:background="#FFFFFF" android:orientation="horizontal"/> <LinearLayout style="@style/row_style"> <LinearLayout android:id="@+id/ll_test1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.33" android:orientation="vertical"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="@mipmap/ic_launcher"/> <TextView style="@style/item_text_style" android:text="测试1"/> </LinearLayout> <LinearLayout android:id="@+id/ll_test2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.33" android:orientation="vertical"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="@mipmap/ic_launcher"/> <TextView style="@style/item_text_style" android:text="测试2"/> </LinearLayout> <LinearLayout android:id="@+id/ll_test3" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.33" android:orientation="vertical"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="@mipmap/ic_launcher"/> <TextView style="@style/item_text_style" android:text="测试3"/> </LinearLayout> </LinearLayout> <LinearLayout style="@style/row_style"> <LinearLayout android:id="@+id/ll_test4" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.33" android:orientation="vertical"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="@mipmap/ic_launcher"/> <TextView style="@style/item_text_style" android:text="测试4"/> </LinearLayout> <LinearLayout android:id="@+id/ll_test5" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.33" android:orientation="vertical"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="@mipmap/ic_launcher"/> <TextView style="@style/item_text_style" android:text="测试5"/> </LinearLayout> <!-- 下面是一个空的布局,用于占位,便于控件各占三分之一屏幕--> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.33" android:orientation="vertical"/> </LinearLayout> <LinearLayout android:id="@+id/ll_bottom_split" android:layout_width="match_parent" android:layout_height="15dp" android:background="#FFFFFF" android:orientation="horizontal"/></LinearLayout>
styles.xml
<style name="item_text_style"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> <item name="android:layout_gravity">center</item> <item name="android:layout_marginTop">11dp</item> <item name="android:background">#FFFFFF</item> <item name="android:gravity">center</item> <item name="android:textSize">13sp</item> <item name="android:textColor">#333333</item> </style> <style name="row_style"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">wrap_content</item> <item name="android:background">#FFFFFF</item> <item name="android:paddingTop">11dp</item> <item name="android:paddingBottom">11dp</item> </style>
作者:程序园中猿
链接:https://www.jianshu.com/p/2d39c4b5832d
點(diǎn)擊查看更多內(nèi)容
為 TA 點(diǎn)贊
評(píng)論
評(píng)論
共同學(xué)習(xí),寫(xiě)下你的評(píng)論
評(píng)論加載中...
作者其他優(yōu)質(zhì)文章
正在加載中
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶(hù)
支付方式
打開(kāi)微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得
100積分直接送
付費(fèi)專(zhuān)欄免費(fèi)學(xué)
大額優(yōu)惠券免費(fèi)領(lǐng)