跳转到帖子

游客您好,欢迎来到黑客世界论坛!您可以在这里进行注册。

赤队小组-代号1949(原CHT攻防小组)在这个瞬息万变的网络时代,我们保持初心,创造最好的社区来共同交流网络技术。您可以在论坛获取黑客攻防技巧与知识,您也可以加入我们的Telegram交流群 共同实时探讨交流。论坛禁止各种广告,请注册用户查看我们的使用与隐私策略,谢谢您的配合。小组成员可以获取论坛隐藏内容!

TheHackerWorld官方

精选回复

发布于

1895087-20220709185640450-778763439.png

 

 

 

EditText是文本编辑框,用户可在此输入文本等信息。

 

EditText的常用属性说明如下:
(1)、inputType:指定输入的文本类型。若同时使用多种文本类型,则可使用竖线“|”把多种文本类型拼接起来。
(2)、maxLength:指定文本允许输入的最大长度。
(3)、hint:指定提示文本的内容。
(4)、textColorHint:指定提示文本的颜色。

 

 

 

 

 

 

1895087-20220709185742624-1953218880.png

 

 

 

 

 

 

 

 

1895087-20220709185803131-577346191.png

 

 

 

 

 

 

<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <!-- 指定了形状内部的填充颜色 -->
    <solid android:color="#ffffff" />
    <!-- 指定了形状轮廓的粗细与颜色 -->
    <stroke android:width="1dp“ android:color="#aaaaaa" />
    <!-- 指定了形状四个圆角的半径 -->
    <corners android:radius="5dp" />
    <!-- 指定了形状四个方向的间距 -->
    <padding
        android:bottom="2dp“ android:left="2dp"
        android:right="2dp“ android:top="2dp" />
</shape>

 

 

 

 

 

 

1895087-20220709185839897-76718206.png

 

 

 

前一步定义了两个圆角矩形,第一个是灰色的圆角矩形,可在未输入时展示该形状;第二个是蓝色的圆角矩形,用于正在输入时候展示。

 

然后定义状态列表图形分别指定不同状态时候的图形显示。
<selector xmlns:android="http://schemas.android.com/apk/res/android">
               <item android:state_focused="true" android:drawable="@drawable/shape_edit_focus"/>
               <item android:drawable="@drawable/shape_edit_normal"/>
</selector>

 

 

 

 

 

 

 

==============================================================================================================

 

 

 

 

 

 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="5dp"
    android:orientation="vertical" >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:text="下面是登录信息"
        android:textColor="@color/black"
        android:textSize="17sp" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:maxLength="10"
        android:hint="请输入用户名"
        android:textColor="@color/black"
        android:textSize="17sp" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textPassword"
        android:maxLength="8"
        android:hint="请输入密码"
        android:textColor="@color/black"
        android:textSize="17sp" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="下面是手机信息"
        android:textColor="@color/black"
        android:textSize="17sp" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="number"
        android:maxLength="11"
        android:hint="请输入11位手机号码"
        android:textColor="@color/black"
        android:textSize="17sp" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="numberPassword"
        android:maxLength="6"
        android:hint="请输入6位服务密码"
        android:textColor="@color/black"
        android:textSize="17sp" />

</LinearLayout>

1895087-20220709185958224-492123970.png

 

 1895087-20220709190010344-1113546026.png

 

 

 

 

 

 

 

 

 

 

 

package com.example.myapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;


public class MainActivity extends AppCompatActivity
{

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


    }


}

1895087-20220709190042005-1478163506.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1895087-20220709190105297-65113458.png

 

 

 

 

 

 

 

 

 

=================================================================================

 

 

 

 

 

 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="5dp"
    android:orientation="vertical" >

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="text"
        android:hint="这是默认边框"
        android:textColor="@color/black"
        android:textSize="17sp" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:inputType="text"
        android:hint="我的边框不见了"
        android:background="@null"
        android:textColor="@color/black"
        android:textSize="17sp" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:inputType="text"
        android:hint="我的边框是圆角"
        android:background="@drawable/editext_selector"
        android:textColor="@color/black"
        android:textSize="17sp" />

</LinearLayout>

1895087-20220709190721234-1765970842.png

 

 

 

 

 

 

 

 

 

 

 

package com.example.myapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;


public class MainActivity extends AppCompatActivity
{

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


    }


}

1895087-20220709190746189-1002853539.png

 

 

 

 

 

 

 

 

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <!-- 指定了形状内部的填充颜色 -->
    <solid android:color="#ffffff" />

    <!-- 指定了形状轮廓的粗细与颜色 -->
    <stroke
        android:width="1dp"
        android:color="#aaaaaa" />

    <!-- 指定了形状四个圆角的半径 -->
    <corners android:radius="5dp" />

    <!-- 指定了形状四个方向的间距 -->
    <padding
        android:bottom="2dp"
        android:left="2dp"
        android:right="2dp"
        android:top="2dp" />

</shape>

1895087-20220709190955663-950379573.png

 

 

 

 

 

 

 

 

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <!-- 指定了形状内部的填充颜色 -->
    <solid android:color="#ffffff" />

    <!-- 指定了形状轮廓的粗细与颜色 -->
    <stroke
        android:width="1dp"
        android:color="#0000ff" />

    <!-- 指定了形状四个圆角的半径 -->
    <corners android:radius="5dp" />

    <!-- 指定了形状四个方向的间距 -->
    <padding
        android:bottom="2dp"
        android:left="2dp"
        android:right="2dp"
        android:top="2dp" />

</shape>

1895087-20220709191053441-463291799.png

 

 

 

 

 

 

 

 

 

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" android:drawable="@drawable/shape_edit_focus"/>
    <item android:drawable="@drawable/shape_edit_normal"/>
</selector>

1895087-20220709191120976-897797497.png

 

 

 

 

 

 

 

 

=============================================================================================================

 

 

 

 

 

 

 

 

1895087-20220709191946899-380585278.png

 

 

1895087-20220709191933825-961217920.png

 

 

 

 

 

 

 

 

 

 

1895087-20220709192007050-1407677504.png

 

 1895087-20220709192022710-1941988073.png

 

 

 

 

 

 

 

1895087-20220709192043382-1336421820.png

 

 1895087-20220709192058658-875099512.png

 

 

 

 

 

 

 

 

 

 

 

 

 

=================================================================================================

 

 

 

 

 

 

 

 

 

1895087-20220709191521686-833843950.png

 

 1895087-20220709191545714-255096244.png

 

 

1895087-20220709191611942-1356971980.png

 

 

1895087-20220709191640836-313186737.png

 

 

 

1895087-20220709191657630-423285598.png

 

 

 

1895087-20220709191720110-546498717.png

 

创建帐户或登录后发表意见

最近浏览 0

  • 没有会员查看此页面。