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>
    
    



  • 相关阅读:
    TCP,UDP协议下的socket通信
    socket套接字
    野指针
    各种数据类型与零值比较规范
    【C++复习】1.1基本概念
    【转载】C++中的static关键字的总结
    Windows10下搭建汇编语言开发环境(利用DOSBOX和MASM32)
    初试ARM开发板
    命令行中编译和运行JAVA程序出现“错误: 找不到或无法加载主类”
    用c语言产生随机数的方法
  • 原文地址:https://www.cnblogs.com/emoji/p/4436836.html
Copyright © 2011-2022 走看看