本文整理汇总了Java中android.widget.TextView.postDelayed方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.postDelayed方法的具体用法?Java TextView.postDelayed怎么用?Java TextView.postDelayed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TextView
的用法示例。
在下文中一共展示了TextView.postDelayed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
place = (TextView) findViewById(R.id.tv_placeholder);
textView = (TextView) findViewById(R.id.tv_info);
textView.postDelayed(new Runnable() {
@Override
public void run() {
place.setVisibility(View.GONE);
if (EmulatorDetector.getDefault().isEmulator()) {
textView.setText("This device is emulator\n" + EmulatorDetector.getDefault().getEmulatorName());
} else {
textView.setText("This device is not emulator\n");
}
}
}, 1000L);
}
示例2: onCreate
import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setTitle("线性排布");
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
textView1 = (TextView) findViewById(R.id.text1);
textView2 = (TextView) findViewById(R.id.text2);
textView3 = (TextView) findViewById(R.id.text3);
textView4 = (TextView) findViewById(R.id.text4);
helper = new SimpleHelper();
SimpleHelperAdapter adapter = new SimpleHelperAdapter(helper);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.addItemDecoration(new StickyHeaderDecoration(adapter));
recyclerView.setAdapter(adapter);
helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.TYPE_FOUR, 3);
textView3.postDelayed(new Runnable() {
@Override
public void run() {
Random random = new Random();
int rand = random.nextInt(6);
List<MultiHeaderEntity> list = new ArrayList<>();
for (int i = 0, size = rand + 1; i < size; i++) {
list.add(new ThirdItem(String.format("我是第三种类型%d", i), 12 + i));
}
textView3.setText(String.format("类型3的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", helper.getRandomId()), SimpleHelper.TYPE_FOUR);
}
}, 3000);
}
示例3: onCreate
import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setTitle("Rx线性排布");
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
textView1 = (TextView) findViewById(R.id.text1);
textView2 = (TextView) findViewById(R.id.text2);
textView3 = (TextView) findViewById(R.id.text3);
textView4 = (TextView) findViewById(R.id.text4);
helper = new RxAdapterHelper();
SimpleRxHelperAdapter adapter = new SimpleRxHelperAdapter(helper);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.addItemDecoration(new StickyHeaderDecoration(adapter));
recyclerView.setAdapter(adapter);
helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.TYPE_FOUR, 3);
textView3.postDelayed(new Runnable() {
@Override
public void run() {
Random random = new Random();
int rand = random.nextInt(6);
List<MultiHeaderEntity> list = new ArrayList<>();
for (int i = 0, size = rand + 1; i < size; i++) {
list.add(new ThirdItem(String.format("我是第三种类型%d", i), 12 + i));
}
textView3.setText(String.format("类型3的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", helper.getRandomId()), SimpleHelper.TYPE_FOUR);
}
}, 3000);
}
示例4: onCreate
import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setTitle("一般线性排布");
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
textView1 = (TextView) findViewById(R.id.text1);
textView2 = (TextView) findViewById(R.id.text2);
textView3 = (TextView) findViewById(R.id.text3);
textView4 = (TextView) findViewById(R.id.text4);
helper = new SimpleCommonHelper();
SimpleCommonHelperAdapter adapter = new SimpleCommonHelperAdapter(helper);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
helper.notifyLoadingDataAndHeaderChanged(SimpleHelper.TYPE_FOUR, 3);
textView3.postDelayed(new Runnable() {
@Override
public void run() {
Random random = new Random();
int rand = random.nextInt(6);
List<MultiHeaderEntity> list = new ArrayList<>();
for (int i = 0, size = rand + 1; i < size; i++) {
list.add(new ThirdItem(String.format("我是第三种类型%d", i), 12 + i));
}
textView3.setText(String.format("类型3的数量:%d", list.size()));
helper.notifyMoudleDataAndHeaderChanged(list, new HeaderThirdItem("我是第三种类型的头", helper.getRandomId()), SimpleHelper.TYPE_FOUR);
}
}, 3000);
}
示例5: onCreate
import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tvIcon1 = (TextView) findViewById(R.id.tv_icon_1);
tvIcon2 = (TextView) findViewById(R.id.tv_icon_2);
tvIcon3 = (TextView) findViewById(R.id.tv_icon_3);
tvIcon4 = (TextView) findViewById(R.id.tv_icon_4);
tvColor1 = (TextView) findViewById(R.id.tv_color_1);
tvColor2 = (TextView) findViewById(R.id.tv_color_2);
tvColor3 = (TextView) findViewById(R.id.tv_color_3);
Drawable icon1 = OneDrawable.createBgDrawable(this, R.drawable.ic_action_add);
tvIcon1.setBackgroundDrawable(icon1);
tvIcon1.setClickable(true);
tvIcon1.setEnabled(false);
tvIcon1.postDelayed(new Runnable() {
@Override
public void run() {
tvIcon1.setEnabled(true);
}
}, 3000);
Drawable icon2 = OneDrawable.createBgDrawableWithDarkMode(this, R.drawable.ic_action_add, 0.4f);
tvIcon2.setBackgroundDrawable(icon2);
tvIcon2.setClickable(true);
Drawable icon3 = OneDrawable.createBgDrawableWithAlphaMode(this, R.drawable.ic_action_name);
tvIcon3.setBackgroundDrawable(icon3);
tvIcon3.setClickable(true);
Drawable icon4 = OneDrawable.createBgDrawableWithAlphaMode(this, R.drawable.ic_action_name, 0.3f);
tvIcon4.setBackgroundDrawable(icon4);
tvIcon4.setClickable(true);
Drawable color1 = OneDrawable.createBgColorWithAlphaMode(this, getResources().getColor(R.color.colorPrimary));
tvColor1.setBackgroundDrawable(color1);
tvColor1.setClickable(true);
Drawable color2 = OneDrawable.createBgColor(this, getResources().getColor(R.color.colorAccent));
tvColor2.setBackgroundDrawable(color2);
tvColor2.setClickable(true);
tvColor2.setEnabled(false);
tvColor2.postDelayed(new Runnable() {
@Override
public void run() {
tvColor2.setEnabled(true);
}
}, 1000);
Drawable color3 = OneDrawable.createBgColor(this, Color.parseColor("#cccccc"));
tvColor3.setBackgroundDrawable(color3);
tvColor3.setClickable(true);
tvColor3.setEnabled(false);
tvColor3.postDelayed(new Runnable() {
@Override
public void run() {
tvColor3.setEnabled(true);
}
}, 1000);
}