当前位置: 首页>>代码示例>>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;未经允许,请勿转载。