控件和背景的控制与嵌入式标题栏

android showDividers属性

android:showDividers="middle"android

android:showDividers属性能够设置以下4个值:ide

none:不显示分隔线;spa

beginning:在LinearLayout的开始处显示分隔线;图片

end:在Linearlayout的结尾处显示分隔线;get

middle:在LinearLayout中的每两个组件间显示分隔线;it

图片自适应io

<ImageView
    android:scaleType="fitXY"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/start_loading" />

控件能够设置各类旋转,渐变 等等。。table

//控件旋转130度
tanchu.animate().rotation(130);

控件能够设置显示或者隐藏的方法List

XML文件中给控件设置初始状态-------gone是隐藏自适应

android:visibility="gone"

而后代码设置改变方法--------visible是显示

setVisibility(View.VISIBLE);

背景的透明度设置

//获取背景
WindowManager.LayoutParams attributes = getWindow().getAttributes();
//背景颜色设置0.5透明度
attributes.alpha = 0.5f;
getWindow().setAttributes(attributes);

状态栏显示

第一种

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_deng_lu2);
//        嵌入是状态栏
//        getWindow().setStatusBarColor(0xff24cf5f);

第二种:在res文件stylesresources标签中添加

<item name="android:windowTranslucentStatus">true</item>

实时监听输入框:addTextChangedListener()

zhanghao_denglu.addTextChangedListener(new TextWatcher() {
    //状态改变前
    @Override
    public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
    }
    //状态改变中
    @Override
    public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
    }
    //状态改变后
    @Override
    public void afterTextChanged(Editable editable) {
    }
});
相关文章
相关标签/搜索