當前位置: 首頁>>代碼示例>>Java>>正文


Java ListView.post方法代碼示例

本文整理匯總了Java中android.widget.ListView.post方法的典型用法代碼示例。如果您正苦於以下問題:Java ListView.post方法的具體用法?Java ListView.post怎麽用?Java ListView.post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.ListView的用法示例。


在下文中一共展示了ListView.post方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: OptionsDialog

import android.widget.ListView; //導入方法依賴的package包/類
public OptionsDialog(Activity activity) {
    this.activity = activity;
    this.mDialog = new Dialog(activity, R.style.BottomDialog);

    mDialog.getWindow().setGravity(Gravity.BOTTOM);
    mDialog.getWindow().setWindowAnimations(R.style.BottomDialog_Animation);
    mDialog.setCanceledOnTouchOutside(true);

    View view = LayoutInflater.from(activity).inflate(R.layout.options_container, null);
    listView = (ListView) view.findViewById(R.id.options_list);

    contentView = (LinearLayout) view.findViewById(R.id.options_container);

    titleText = (TextView) view.findViewById(R.id.options_title);
    divide = view.findViewById(R.id.options_divide);
    mDialog.setContentView(view);
    listView.post(new Runnable() {
        @Override
        public void run() {
            setDialogHeight();
        }
    });
}
 
開發者ID:DuanJiaNing,項目名稱:Musicoco,代碼行數:24,代碼來源:OptionsDialog.java

示例2: scrollMyListView

import android.widget.ListView; //導入方法依賴的package包/類
private void scrollMyListView(final int position) {
    final ListView myListView = (ListView) findViewById(R.id.listMessages);
    myListView.post(new Runnable() {
        @Override
        public void run() {
            // Select the last row so it will scroll into view...
            myListView.setSelection(position);
        }
    });
}
 
開發者ID:Thizizmyname,項目名稱:MyPlace,代碼行數:11,代碼來源:MessageActivity.java

示例3: onCreateDialogView

import android.widget.ListView; //導入方法依賴的package包/類
@Override
protected View onCreateDialogView() {
    int numPlayers = mPrefs.getInt(SettingsActivity.KEY_PLAYERS_LIST, SettingsActivity.DEF_PLAYERS_LIST);
    ListView listPlayers = new ListView(mContext);
    listPlayers.setAdapter(mListAdapter);
    mListAdapter.setCount(numPlayers);

    // Needed to show the keyboard when a editText inside the listView is focused
    listPlayers.post(new Runnable() {
        @Override
        public void run() {
            Window window = getDialog().getWindow();
            if (window != null) {
                window.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
            }
        }
    });

    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
    LinearLayout linearLayout = new LinearLayout(mContext);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.setGravity(Gravity.CENTER);
    // Needed to avoid autofocus of editText views
    linearLayout.setFocusableInTouchMode(true);
    linearLayout.addView(listPlayers, layoutParams);

    return linearLayout;
}
 
開發者ID:dftec-es,項目名稱:planetcon,代碼行數:29,代碼來源:ListPlayersPreference.java

示例4: setSelection

import android.widget.ListView; //導入方法依賴的package包/類
public final void setSelection(int i, int y_)
{
    final ListView flv$ = listView;
    final int position$ = i, y$ = y_;
    flv$.post(new Runnable()
    {
        public void run()
        {
            flv$.setSelectionFromTop(position$, y$ > 0 ? y$ : flv$.getHeight() / 2);
        }
    });
    currentPosition = i;
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:14,代碼來源:FileListView.java

示例5: scrollToPosition

import android.widget.ListView; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private static void scrollToPosition(final ListView messageListView, final int position, final int y, final ScrollToPositionListener listener) {
	messageListView.post(new Runnable() {
		
		@Override
		public void run() {				
			messageListView.setSelectionFromTop(position, y);
			
			if (listener != null) {
				listener.onScrollEnd();
			}
		}
	});			
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:15,代碼來源:ListViewUtil.java

示例6: onViewCreated

import android.widget.ListView; //導入方法依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    listView = (ListView) view.findViewById(R.id.help_list);

    InformationArrayAdapter adapter = new InformationArrayAdapter(getContext());

    adapter.addTitle(R.string.About);
    String title = getString(R.string.app_name) + " (" + getAppVersion() + ")";
    adapter.addText(title, getString(R.string.Info_about));

    adapter.addTitle(R.string.Attention);
    adapter.addText(R.string.Info_attention);

    adapter.addTitle(R.string.Messaging);
    adapter.addText(R.string.Info_messaging);

    adapter.addTitle(R.string.Black_list);
    adapter.addText(R.string.Info_black_list);

    adapter.addTitle(R.string.White_list);
    adapter.addText(R.string.Info_white_list);

    adapter.addTitle(R.string.Journal);
    adapter.addText(R.string.Info_journal);

    adapter.addTitle(R.string.Settings);
    adapter.addText(R.string.Info_settings);

    adapter.addTitle(R.string.Licence);
    adapter.addText(R.string.Info_licence);

    adapter.addTitle(R.string.Author);
    adapter.addText(R.string.Info_author);

    // add adapter to the ListView and scroll list to position
    listView.setAdapter(adapter);
    listView.post(new Runnable() {
        @Override
        public void run() {
            listView.setSelection(listPosition);
        }
    });
}
 
開發者ID:kaliturin,項目名稱:BlackList,代碼行數:46,代碼來源:InformationFragment.java


注:本文中的android.widget.ListView.post方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。