zoukankan      html  css  js  c++  java
  • 巧用TextView实现分隔线

    在写这个项目的时候,需要用到分隔线,思索无果,后来想到TextView恍然大悟,一点小技巧。在在


    先上效果图:


    布局代码:

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/container"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        tools:context="com.example.theold.MainActivity"
        tools:ignore="MergeRootFrame" >
        
      <LinearLayout 
            android:id="@+id/linearlayoutmain"
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
            
            
           
            
            <DigitalClock 
                android:layout_weight="1"
                android:id="@+id/clock"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textSize="70sp"
                android:layout_gravity="center_horizontal"
                android:background="@drawable/time_bg"
                android:textColor="#000000"/>
            
            <TextView 
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textSize="30sp"
                android:fontFamily="宋体"
                android:background="#ADFF2F"
                android:id="@+id/dateandweather"/>
            
           
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">
            <ImageButton 
                android:layout_weight="1"
                android:src="@drawable/img_call"
                android:id="@+id/enterPhoneCall"
                android:background="@drawable/selector"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"/>
            
            <TextView 
                android:background="#000000"
                android:layout_width="4dp"
                android:layout_height="fill_parent"/>
            
            <ImageButton 
                android:layout_weight="1"
                android:src="@drawable/img_message"
                android:id="@+id/enterMessage"
               android:background="@drawable/selector"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                />
            </LinearLayout>
            
            <TextView 
                android:background="#000000"
                android:layout_width="fill_parent"
                android:layout_height="4dp"/>
            
            
     
            
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">
            <ImageButton 
                android:layout_weight="1"
                android:id="@+id/enterFlashlight"
                android:src="@drawable/img_flashlight"
                android:background="@drawable/selector"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                />
            
            <TextView
                 android:background="#000000"
                android:layout_width="4dp"
                android:layout_height="fill_parent"/>
            
            <ImageButton 
                android:layout_weight="1"
                android:id="@+id/enterMusic"
               android:background="@drawable/selector"
               android:src="@drawable/img_music"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" />
            </LinearLayout>
            
           
            <TextView 
                android:background="#000000"
                android:layout_width="fill_parent"
                android:layout_height="4dp"/>
            
            
     
            
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">
            <ImageButton 
                android:layout_weight="1"
                android:id="@+id/enterCamera"
                android:src="@drawable/img_camera"
                android:background="@drawable/selector"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                />
            
            <TextView 
                android:layout_width="4dp"
                android:background="#000000"
                android:layout_height="fill_parent"/>
            
            <ImageButton 
                android:layout_weight="1"
                android:id="@+id/enterPhotos"
                android:src="@drawable/img_photo"
               android:background="@drawable/selector"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                />
            
            
            </LinearLayout>
            
            
            
            <TextView 
                android:background="#000000"
                android:layout_width="fill_parent"
                android:layout_height="4dp"/>
            
            
     
            
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">
            <ImageButton 
                android:layout_weight="1"
                android:id="@+id/enterSOS"
               android:background="@drawable/selector"
                android:src="@drawable/img_sos"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                />
            
            <TextView 
                android:layout_width="4dp"
                android:background="#000000"
                android:layout_height="fill_parent"/>
            
            <ImageButton 
                android:layout_weight="1"
                android:src="@drawable/img_compass"
                android:id="@+id/enterCompass"
               android:background="@drawable/selector"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                />
            </LinearLayout>
            
        
        
        <TextView 
                android:background="#000000"
                android:layout_width="fill_parent"
                android:layout_height="4dp"/>
        
        <LinearLayout 
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">
            <ImageButton 
                android:id="@+id/enterAboutMore"
                android:layout_width="fill_parent"
                android:background="#2E8B57"
                android:src="@drawable/img_aboutmore"
                android:layout_height="wrap_content"/>
            </LinearLayout>
        
        
        </LinearLayout>
    </ScrollView>
    
    



  • 相关阅读:
    struts2第一天——入门和基本操作
    eclipse各种小图标含义
    复制web项目时注意修改web项目名
    AndroidCityPicker仿IOS选择效果
    每日五题(Spring)
    block-循环引用
    给EasyUi的Form加入自己主动填充部分输入框的方法
    智能停车O2O 独角兽初现:“ETCP停车”获5000万美金A轮融资
    解决移动端页面滚动后不触发touchend事件
    《从零開始学Swift》学习笔记(Day 61)——Core Foundation框架之内存管理
  • 原文地址:https://www.cnblogs.com/emoji/p/4436836.html
Copyright © 2011-2022 走看看