Tabview与android中的背景图像

时间:2015-12-16 05:12:48

标签: android

抱歉我的英文不好,我创建类似于什么应用程序的标签,但如何在选项卡和应用程序名称之间放置图像背景当我选择任何标签单独的图像图像可见时请帮我下面任何一个示例图像我需要像这样任何人都请告诉我 enter image description here

2 个答案:

答案 0 :(得分:0)

试试这个

在AppBarLayout背景中设置您的图片。

并替换您的内容布局xml文件。

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.lcom53.toolbarapp.MainActivity">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay"
    android:background="@drawable/photo"
    app:elevation="0dp">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        app:layout_scrollFlags="scroll|enterAlways"
        app:popupTheme="@style/AppTheme.PopupOverlay"
        app:elevation="0dp">


    </android.support.v7.widget.Toolbar>
    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="15dp"
        app:tabSelectedTextColor="#FFFFFF"
        app:tabTextAppearance="@style/MyCustomTabLayout" />
</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_main" />
</android.support.design.widget.CoordinatorLayout>

答案 1 :(得分:0)

在您的appbar中添加Option Explicit Sub DCR() Dim rSrc As Range 'Source Range to be copied Dim WbkTrg As Workbook 'Target Workbook to act upon Dim sWbkTrg As String 'Target Workbook name Dim WshTrg As Worksheet 'Target Worksheet to act upon Dim sWshTrg As String 'Target Worksheet name Dim bMonth As Byte Dim dDate As Date Dim bDay As Byte Dim b As Byte Rem Application Settings OFF Application.EnableEvents = False Application.DisplayAlerts = False Application.ScreenUpdating = False Rem Get User Input Do On Error Resume Next bMonth = InputBox("Enter month number (1 to 12) or 0 to cancel.") On Error GoTo 0 b = 1 + b If bMonth = 0 Then GoTo ExitTkn If b = 3 Then GoTo ExitTkn Loop Until bMonth >= 1 And bMonth <= 12 Rem Set Target Range To Be Copied Into New Workbook Set rSrc = ThisWorkbook.Sheets("Sheet1").Range("A1:G7") Rem Add Target Workbook Set WbkTrg = Workbooks.Add sWbkTrg = "DCR_" & Format(DateSerial(Year(Now), bMonth, 1), "yyyy-mm") & ".xlsx" Rem Delete All Worksheets Minus One In Target Workbook Do With WbkTrg If .Sheets.Count = 1 Then Exit Do .Sheets(1).Delete End With Loop Rem Add Worksheet for each day of the month For bDay = 1 To 31 Rem Set Date & Month dDate = DateSerial(Year(Now), bMonth, bDay) sWshTrg = Format(dDate, "dddd mm-dd-yyyy") If Month(dDate) = bMonth Then Rem Process Worksheets - Days With WbkTrg If bDay = 1 Then Rem Process 1st Day Set WshTrg = .Sheets(bDay) Else Rem Add Remaining Days Set WshTrg = .Sheets.Add(after:=.Sheets(.Sheets.Count)) End If: End With Rem Update Day Standard Data WshTrg.Name = sWshTrg With WshTrg.Range("A1") rSrc.Copy .PasteSpecial Paste:=xlPasteValues .PasteSpecial Paste:=xlPasteFormats .PasteSpecial Paste:=xlPasteColumnWidths .Value = sWshTrg Application.CutCopyMode = False End With End If: Next Rem Save Target Workbook Application.Goto WbkTrg.Sheets(1).Cells(1), 1 On Error Resume Next Workbooks(sWbkTrg).Close 'Close Workbook If Open On Error GoTo 0 WbkTrg.SaveAs Filename:=sWbkTrg ExitTkn: Rem Application Settings ON Application.EnableEvents = True Application.DisplayAlerts = True Application.ScreenUpdating = True End Sub android:background="#00000000",如下所示:

android:background="@drawable/img_transparent"