zoukankan      html  css  js  c++  java
  • 聚焦改变字体,背景颜色

    聚焦改变背景色

    <selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:drawable="@color/red"></item>
    </selector>
     <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="hahah"
            android:background="@drawable/tc1"/>
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/tc1"
            android:textColor="@drawable/tc1"/>

     改变字体颜色

    <resources>
    
        <!-- Base application theme. -->
        <!--<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">-->
        <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
            <!-- Customize your theme here. -->
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorAccent">@color/colorAccent</item>
        </style>
        <style name="style1">
            <item name="android:textSize">25dp</item>
        </style>
        <style name="style2" parent="style1">
        </style>
    </resources>
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:orientation="vertical"
        android:paddingTop="@dimen/activity_vertical_margin"
        tools:context="helloworld.com.inspur.demo8.MainActivity">
    
        <!--<TextView
            style="@style/style1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColor="@drawable/tc1"
            android:text="haah"
            android:id="@+id/tv1"/>
        <TextView
            style="@style/style1"
            android:text="haah"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/tv2"/>-->
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="hahah"
            android:textColor="@drawable/tc1"/>
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="hahah"
            android:textColor="@drawable/tc1"
            />
    
      <!--  <ListView
            android:id="@+id/lv"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
           />-->
    <!--<Button
        android:background="@drawable/bt1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />-->
    </LinearLayout>
  • 相关阅读:
    [转]写给刚工作的技术人员
    IT人士如何有效地学习
    一个学习Unity的网址,记下来以后用.
    .NET Remoting学习总结之一:Remoting的使用场景
    犯了不该犯的错:UNION和UNION ALL没搞清楚,今天写下它们的区别,要谨记在心!
    实用代码:单个读取Console中输入的键
    无意中试用了一下PostSharp,感觉很不错,看得出它对那些重复性的编程会有不少帮助.
    博客的搬迁历程
    .NET 6期 11月上旬教学计划(11月6日更新)
    .NET 6期 10月下旬教学计划(10月31日更新)
  • 原文地址:https://www.cnblogs.com/excellencesy/p/9036078.html
Copyright © 2011-2022 走看看