本文整理匯總了Java中android.widget.ScrollView.post方法的典型用法代碼示例。如果您正苦於以下問題:Java ScrollView.post方法的具體用法?Java ScrollView.post怎麽用?Java ScrollView.post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ScrollView
的用法示例。
在下文中一共展示了ScrollView.post方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: scrollToBottom
import android.widget.ScrollView; //導入方法依賴的package包/類
public static void scrollToBottom(final ScrollView scrollView) {
if (scrollView != null) {
scrollView.post(new Runnable() {
@Override
public void run() {
scrollView.fullScroll(ScrollView.FOCUS_DOWN);
}
});
}
}
示例2: addMessageFromUser
import android.widget.ScrollView; //導入方法依賴的package包/類
/**
* Adds a message dialog view to the UI.
*
* @param message ConversationMessage containing a message and the sender.
*/
private void addMessageFromUser(ConversationMessage message) {
View messageView;
LinearLayout messageContainer = (LinearLayout) findViewById(R.id.message_container);
if (message.getUser().equals(USER_WATSON)) {
messageView = this.getLayoutInflater().inflate(R.layout.watson_text, messageContainer, false);
TextView watsonMessageText = (TextView) messageView.findViewById(R.id.watsonTextView);
watsonMessageText.setText(message.getMessageText());
if (message.getMessageText() != null)
Log.i("User will see this", message.getMessageText());
// if (message.getMessageText().contains("violations")) {
// Log.i("Inside VIOlations","Vioation indisa");
// messageView = this.getLayoutInflater().inflate(R.layout.watson_text, messageContainer, false);
//// TextView watsonMessageText = (TextView)messageView.findViewById(R.id.watsonTextView);
// watsonMessageText.setText("you have fines");
// }
} else {
messageView = this.getLayoutInflater().inflate(R.layout.user_text, messageContainer, false);
TextView userMessageText = (TextView) messageView.findViewById(R.id.userTextView);
userMessageText.setText(message.getMessageText());
}
messageContainer.addView(messageView);
// Scroll to the bottom of the view so the user sees the update.
final ScrollView scrollView = (ScrollView) findViewById(R.id.message_scrollview);
scrollView.post(new Runnable() {
@Override
public void run() {
scrollView.fullScroll(View.FOCUS_DOWN);
}
});
}
示例3: createListenerLog
import android.widget.ScrollView; //導入方法依賴的package包/類
static void createListenerLog(LinearLayout messagesContainer, String text) {
String currentDateTime = new SimpleDateFormat("HH:mm:ss.SSS", Locale.getDefault()).format(new Date());
TextView textView = new TextView(messagesContainer.getContext());
textView.setTextColor(Color.WHITE);
textView.setTextSize(14);
textView.setText(currentDateTime + ": " + text);
messagesContainer.addView(textView);
final ScrollView scrollView = (ScrollView)messagesContainer.getParent();
scrollView.post(new Runnable() {
public void run() {
scrollView.fullScroll(ScrollView.FOCUS_DOWN);
}
});
}
示例4: moveScroll
import android.widget.ScrollView; //導入方法依賴的package包/類
private void moveScroll() {
View view = getView();
if (view != null) {
final ScrollView scroll = (ScrollView) view.findViewById(R.id.scroll);
scroll.post(new Runnable() {
@Override
public void run() {
scroll.fullScroll(ScrollView.FOCUS_DOWN);
}
});
}
}
示例5: onCreate
import android.widget.ScrollView; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
applyColorTheme();
setContentView(R.layout.activity_settings);
setupAppBar(R.id.toolbar, R.string.title_settings, true, true);
setSettingItems();
final ScrollView mScrollView = ((ScrollView) findViewById(R.id.base));
prefsListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
Settings.changed = true;
}
};
SettingValues.prefs.registerOnSharedPreferenceChangeListener(prefsListener);
mScrollView.post(new Runnable() {
@Override
public void run() {
ViewTreeObserver observer = mScrollView.getViewTreeObserver();
if (getIntent().hasExtra("position")) {
mScrollView.scrollTo(0, getIntent().getIntExtra("position", 0));
}
observer.addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
@Override
public void onScrollChanged() {
scrollY = mScrollView.getScrollY();
}
});
}
});
}
示例6: scrollToBottom
import android.widget.ScrollView; //導入方法依賴的package包/類
public static void scrollToBottom(final ScrollView scroll) {
if (scroll != null) {
scroll.post(new Runnable() {
@Override
public void run() {
scroll.fullScroll(View.FOCUS_DOWN);
}
});
}
}
示例7: scrollToBottom
import android.widget.ScrollView; //導入方法依賴的package包/類
private static void scrollToBottom(final ScrollView sv) {
sv.post(new Runnable() {
@Override
public void run() {
sv.fullScroll(View.FOCUS_DOWN);
}
});
}
示例8: onOptionsItemSelected
import android.widget.ScrollView; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
/*
case android.R.id.home:
//NavUtils.navigateUpTo(this, new Intent(this, HjemAkt.class));
finish();
return true;
*/
case 642:
App.fejlsøgning = !App.fejlsøgning;
App.kortToast("Log.fejlsøgning = " + App.fejlsøgning);
return true;
case 644:
// scp /home/j/android/dr-radio-android/DRRadiov3/out/production/DRRadiov3/DRRadiov3.apk j:../lundogbendsen/hjemmeside/
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://android.lundogbendsen.dk/DRRadiov3.apk")));
return true;
case 13643:
App.langToast("Server:\n" + new Date(App.serverCurrentTimeMillis()) + "\n/Lokalt:\n" + new Date());
return true;
case 643:
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
TextView tv = new TextView(this);
tv.setText(Log.getLog());
android.util.Log.i("", Log.getLog());
tv.setTextSize(10f);
tv.setBackgroundColor(0xFF000000);
tv.setTextColor(0xFFFFFFFF);
final ScrollView sv = new ScrollView(this);
sv.addView(tv);
dialog.setView(sv);
dialog.show();
sv.post(new Runnable() {
public void run() {
sv.fullScroll(View.FOCUS_DOWN);
}
});
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(Log.getLog());
App.kortToast("Log kopieret til udklipsholder");
return true;
case 646:
Log.rapporterFejl(new Exception("Fejlrapport for enhed sendes"));
return true;
case 647:
throw new IllegalStateException("Brugeren lavede et test-crash");
}
return super.onOptionsItemSelected(item);
}