您现在的位置是:主页 > news > 做百度推广网站多少钱/b2b平台有哪些

做百度推广网站多少钱/b2b平台有哪些

admin2025/5/31 19:41:30news

简介做百度推广网站多少钱,b2b平台有哪些,衡水做网站电话,武汉seo优化厂家实用代码分享,实现点击几次某个控件,显示隐藏功能。代码很简单但却很实用,比如可以实现测试环境和正式环境的切换功能,隐藏提交应用日志等等。直接上代码Activitypublic class MainActivity extends AppCompatActivity {//全局属性…

做百度推广网站多少钱,b2b平台有哪些,衡水做网站电话,武汉seo优化厂家实用代码分享,实现点击几次某个控件,显示隐藏功能。代码很简单但却很实用,比如可以实现测试环境和正式环境的切换功能,隐藏提交应用日志等等。直接上代码Activitypublic class MainActivity extends AppCompatActivity {//全局属性…

实用代码分享,实现点击几次某个控件,显示隐藏功能。代码很简单但却很实用,比如可以实现测试环境和正式环境的切换功能,隐藏提交应用日志等等。

直接上代码

Activity

public class MainActivity extends AppCompatActivity {

//全局属性

private TextView mTitleView;

private Spinner mSpinnerView;

private int touchCount = 0;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

initView();

setListener();

}

private void initView(){

mSpinnerView = (Spinner) findViewById(R.id.spinner);

mSpinnerView.setVisibility(View.INVISIBLE);

mTitleView = (TextView) findViewById(R.id.textViewTitle);

}

private void setListener(){

mTitleView.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

touchCount += 1;

if (touchCount == 5) {

mSpinnerView.setVisibility(View.VISIBLE);

touchCount = 0;

} else {

Toast.makeText(getApplicationContext(), "Click more " + Integer.toString(5 - touchCount), Toast.LENGTH_SHORT).show();

}

}

});

}

}

代码中设置spinner值,并设置监听事件

//赋值

String[] arrayStr= { "111", "222", "333", "444", "555" }; //定义数组

//将可选内容与ArrayAdapter连接,

ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, arrayStr);

mSpinnerView.setAdapter(adapter);

//设置监听事件

mSpinnerView.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {

@Override

public void onItemSelected(AdapterView> parent, View view, int position, long id) {

String selectEmail = getResources().getStringArray(R.array.select_email)[position];

String usename = userNameArray[position];

mEtEmail.setText(selectEmail);

mEtName.setText(usename);

}

@Override

public void onNothingSelected(AdapterView> parent) {

}

});

布局文件

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:paddingTop="@dimen/activity_vertical_margin"

android:background="@android:color/darker_gray"

tools:context="cc.lielang.filedemo.MainActivity">

android:id="@+id/textViewTitle"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_gravity="center_horizontal"

android:layout_marginBottom="0dp"

android:text="点我"

android:textColor="#FFFFFF"

android:textSize="24sp"

android:textStyle="bold" />

android:id="@+id/spinner"

android:layout_width="match_parent"

android:layout_height="30dp"

android:layout_gravity="center"

android:background="#FFFFFF"

android:entries="@array/select_url"

android:textAlignment="center" />

资源文件

1

2

3

4

5

over