本文整理匯總了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);
}