Java Code Examples for android.widget.ListView#setId()

The following examples show how to use android.widget.ListView#setId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PullToRefreshListView.java    From letv with Apache License 2.0 6 votes vote down vote up
protected final ListView createRefreshableView(Context context, AttributeSet attrs) {
    ListView lv = new InternalListView(this, context, attrs);
    lv.setLayoutParams(new LayoutParams(-1, -1));
    int mode = getMode();
    String pullLabel = context.getString(2131100695);
    String refreshingLabel = context.getString(2131100699);
    String releaseLabel = context.getString(2131100700);
    if (mode == 1 || mode == 3) {
        FrameLayout frame = new FrameLayout(context);
        this.mHeaderLoadingView = new PullToRefreshHeaderView(context, 1, releaseLabel, pullLabel, refreshingLabel, this.objs);
        frame.addView(this.mHeaderLoadingView, -1, -2);
        this.mHeaderLoadingView.setVisibility(8);
        lv.addHeaderView(frame, null, false);
    }
    if (mode == 2 || mode == 3) {
        this.mLvFooterLoadingFrame = new FrameLayout(context);
        this.mFooterLoadingView = new PullToRefreshHeaderView(context, 2, releaseLabel, pullLabel, refreshingLabel, this.objs);
        this.mLvFooterLoadingFrame.addView(this.mFooterLoadingView, -1, -2);
        this.mFooterLoadingView.setVisibility(8);
    }
    lv.setId(16908298);
    return lv;
}
 
Example 2
Source File: PullToRefreshListView.java    From AndroidBase with Apache License 2.0 5 votes vote down vote up
@Override
protected ListView createRefreshableView(Context context, AttributeSet attrs) {
	ListView lv = createListView(context, attrs);

	// Set it to this so it can be used in ListActivity/ListFragment
	lv.setId(android.R.id.list);
	return lv;
}
 
Example 3
Source File: PullToRefreshListView.java    From Alibaba-Android-Certification with MIT License 5 votes vote down vote up
@Override
protected ListView createRefreshableView(Context context, AttributeSet attrs) {
	ListView lv = createListView(context, attrs);

	// Set it to this so it can be used in ListActivity/ListFragment
	lv.setId(android.R.id.list);
	return lv;
}
 
Example 4
Source File: PullToRefreshListView.java    From NetEasyNews with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected ListView createRefreshableView(Context context, AttributeSet attrs) {
	ListView lv = createListView(context, attrs);

	// Set it to this so it can be used in ListActivity/ListFragment
	lv.setId(android.R.id.list);
	return lv;
}
 
Example 5
Source File: PullToRefreshListView.java    From FacebookNewsfeedSample-Android with Apache License 2.0 5 votes vote down vote up
@Override
protected ListView createRefreshableView(Context context, AttributeSet attrs) {
	ListView lv = createListView(context, attrs);

	// Set it to this so it can be used in ListActivity/ListFragment
	lv.setId(android.R.id.list);
	return lv;
}
 
Example 6
Source File: SlidingListActivity.java    From Moring-Alarm with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	mHelper = new SlidingActivityHelper(this);
	mHelper.onCreate(savedInstanceState);
	ListView listView = new ListView(this);
	listView.setId(android.R.id.list);
	setContentView(listView);
}
 
Example 7
Source File: SlidingListActivity.java    From KickAssSlidingMenu with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	mHelper = new SlidingActivityHelper(this);
	mHelper.onCreate(savedInstanceState);
	ListView listView = new ListView(this);
	listView.setId(android.R.id.list);
	setContentView(listView);
}
 
Example 8
Source File: PullToRefreshListView.java    From ONE-Unofficial with Apache License 2.0 5 votes vote down vote up
@Override
protected ListView createRefreshableView(Context context, AttributeSet attrs) {
	ListView lv = createListView(context, attrs);

	// Set it to this so it can be used in ListActivity/ListFragment
	lv.setId(android.R.id.list);
	return lv;
}
 
Example 9
Source File: PullToRefreshListView.java    From GifAssistant with Apache License 2.0 5 votes vote down vote up
@Override
protected ListView createRefreshableView(Context context, AttributeSet attrs) {
	ListView lv = createListView(context, attrs);

	// Set it to this so it can be used in ListActivity/ListFragment
	lv.setId(android.R.id.list);
	return lv;
}
 
Example 10
Source File: PassphraseTypeDialogFragment.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View v = inflater.inflate(R.layout.sync_passphrase_types, null);

    // Configure the passphrase type list
    ListView list = (ListView) v.findViewById(R.id.passphrase_types);
    Adapter adapter = createAdapter(getCurrentTypeFromArguments());
    list.setAdapter(adapter);
    list.setId(R.id.passphrase_type_list);
    list.setOnItemClickListener(this);
    list.setDividerHeight(0);
    PassphraseType currentType = getCurrentTypeFromArguments();
    list.setSelection(adapter.getPositionForType(currentType));

    // Configure the hint to reset the passphrase settings
    // Only show this hint if encryption has been set to use sync passphrase
    if (currentType == PassphraseType.CUSTOM_PASSPHRASE) {
        TextView instructionsView = (TextView) v.findViewById(R.id.reset_sync_text);
        instructionsView.setVisibility(View.VISIBLE);
        instructionsView.setMovementMethod(LinkMovementMethod.getInstance());
        instructionsView.setText(getResetText());
    }

    // Create and return the dialog
    return new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
            .setNegativeButton(R.string.cancel, this)
            .setTitle(R.string.sync_passphrase_type_title)
            .setView(v)
            .create();
}
 
Example 11
Source File: PullToRefreshListView.java    From SwipeMenuAndRefresh with Apache License 2.0 5 votes vote down vote up
@Override
protected ListView createRefreshableView(Context context, AttributeSet attrs) {
    ListView lv = createListView(context, attrs);

    // Set it to this so it can be used in ListActivity/ListFragment
    lv.setId(android.R.id.list);
    return lv;
}
 
Example 12
Source File: PullToZoomListViewEx.java    From likequanmintv with Apache License 2.0 5 votes vote down vote up
/**
 * 创建listView 如果要兼容API9,需要修改此处
 *
 * @param context 上下文
 * @param attrs   AttributeSet
 * @return ListView
 */
@Override
protected ListView createRootView(Context context, AttributeSet attrs) {
    ListView lv = new ListView(context, attrs);
    // Set it to this so it can be used in ListActivity/ListFragment
    lv.setId(android.R.id.list);
    return lv;
}
 
Example 13
Source File: PullToRefreshListView.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected ListView createRefreshableView(Context context, AttributeSet attrs) {
	ListView lv = createListView(context, attrs);

	// Set it to this so it can be used in ListActivity/ListFragment
	lv.setId(android.R.id.list);
	return lv;
}
 
Example 14
Source File: SlidingListActivity.java    From appcan-android with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mHelper = new SlidingActivityHelper(this);
    mHelper.onCreate(savedInstanceState);
    ListView listView = new ListView(this);
    listView.setId(android.R.id.list);
    setContentView(listView);
}
 
Example 15
Source File: PullToRefreshListView.java    From Social with Apache License 2.0 5 votes vote down vote up
@Override
protected ListView createRefreshableView(Context context, AttributeSet attrs) {
	ListView lv = createListView(context, attrs);

	// Set it to this so it can be used in ListActivity/ListFragment
	lv.setId(android.R.id.list);
	return lv;
}
 
Example 16
Source File: PullToRefreshListView.java    From handmarkPulltorefreshLibrary with Apache License 2.0 5 votes vote down vote up
@Override
protected ListView createRefreshableView(Context context, AttributeSet attrs) {
	ListView lv = createListView(context, attrs);

	// Set it to this so it can be used in ListActivity/ListFragment
	lv.setId(android.R.id.list);
	return lv;
}
 
Example 17
Source File: DialogUnit.java    From Dashchan with Apache License 2.0 5 votes vote down vote up
private void display(DialogProvider dialogProvider) {
	Context context = uiManager.getContext();
	FrameLayout content = new FrameLayout(context);
	ListView listView = new ListView(context);
	content.addView(listView, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
	DialogPostsAdapter adapter = new DialogPostsAdapter(dialogProvider, listView);
	listView.setOnItemClickListener(adapter);
	listView.setOnItemLongClickListener(adapter);
	ScrollListenerComposite.obtain(listView).add(new BusyScrollListener(adapter));
	listView.setAdapter(adapter);
	listView.setId(android.R.id.list);
	listView.setDivider(ResourceUtils.getDrawable(context, R.attr.postsDivider, 0));
	final DialogHolder holder = new DialogHolder(adapter, dialogProvider, content, listView);
	uiManager.observable().register(holder);
	ImageLoader.getInstance().observable().register(holder);
	listView.setTag(holder);
	content.setTag(holder);
	dialogStack.push(content);
	dialogProvider.setStateListener((state) -> {
		switch (state) {
			case STATE_LIST: {
				holder.setShowLoading(false);
				holder.requestUpdate();
				return true;
			}
			case STATE_LOADING: {
				holder.setShowLoading(true);
				return true;
			}
			case STATE_ERROR: {
				if (!holder.cancelled) {
					dialogStack.pop();
					return true;
				}
				return false;
			}
		}
		return false;
	});
}
 
Example 18
Source File: PullToRefreshListView.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
protected ListView createRefreshableView(Context context, AttributeSet attributeset)
{
    ListView listview = createListView(context, attributeset);
    listview.setId(0x102000a);
    return listview;
}
 
Example 19
Source File: QuestionnaireView.java    From QuestionnaireView with MIT License 4 votes vote down vote up
private void drawInnerViews(Context context, AttributeSet attrs){
    float density = context.getResources().getDisplayMetrics().density;
    int value16 = (int)(16*density);
    int value10 = (int)(10*density);
    int value40 = (int)(40*density);
    LayoutParams mainLayoutParams = new LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    mainLayoutParams.setMargins(value16,value16,value16,value16);
    setLayoutParams(mainLayoutParams);

    //creation & addition of webview
    webview = new WebView(context, attrs);
    webview.setId(android.R.id.content);
    webview.setLayoutParams(
            new LayoutBuilder()
                    .addWidth(LayoutParams.MATCH_PARENT)
                    .addHeight(LayoutParams.WRAP_CONTENT)
                    .setMargin(value10,value40,0,0)
                    .create()
    );
    webview.getSettings();
    webview.setBackgroundColor(Color.argb(0,0,0,0));
    addView(webview);

    //creation of list view
    listView = new ListView(context, attrs);
    listView.setId(android.R.id.list);
    listView.setLayoutParams(
            new LayoutBuilder()
                    .addWidth(LayoutParams.MATCH_PARENT)
                    .addHeight(LayoutParams.WRAP_CONTENT)
                    .setMargin(0,value10,0,0)
                    .addRule(BELOW, webview.getId() )
                    .create()
    );
    addView(listView );

    //creation & addition of editText
    editTv = new AppCompatEditText(context, attrs);
    editTv.setVisibility(GONE);
    editTv.setId(android.R.id.text1);
    editTv.setLayoutParams(
            new LayoutBuilder()
                    .addWidth(LayoutParams.MATCH_PARENT)
                    .addHeight(LayoutParams.WRAP_CONTENT)
                    .setMargin(value10, value10, 0, 0)
                    .addRule(BELOW, webview.getId())
                    .create()
    );
    editTv.setInputType(InputType.TYPE_CLASS_TEXT);
    editTv.setImeOptions(EditorInfo.IME_ACTION_DONE);
    addView(editTv );

}
 
Example 20
Source File: BufferFragment.java    From tapchat-android with Apache License 2.0 4 votes vote down vote up
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
       LinearLayout layout = new LinearLayout(getActivity());
       layout.setOrientation(LinearLayout.VERTICAL);
       layout.setLayoutParams(new LayoutParams(MATCH_PARENT, MATCH_PARENT));

        View connectionHeaderView = inflater.inflate(R.layout.connection_header, null);
        layout.addView(connectionHeaderView, new LayoutParams(MATCH_PARENT, WRAP_CONTENT));

        View bufferHeaderView = inflater.inflate(R.layout.fragment_buffer_header, null);
        layout.addView(bufferHeaderView, new LayoutParams(MATCH_PARENT, WRAP_CONTENT));

        ListView listView = new ListView(getActivity());
        listView.setId(android.R.id.list);
        listView.setDivider(null);
        listView.setStackFromBottom(true);
        listView.setTranscriptMode(AbsListView.TRANSCRIPT_MODE_NORMAL);
        listView.setSmoothScrollbarEnabled(false);
//        listView.setCacheColorHint(Color.TRANSPARENT);

        LayoutParams params = new LayoutParams(MATCH_PARENT, 0);
        params.weight = 1;
        layout.addView(listView, params);
        View footerView = inflater.inflate(R.layout.fragment_buffer_footer, null);
        layout.addView(footerView, new LayoutParams(MATCH_PARENT, WRAP_CONTENT));

        ((TextView) footerView.findViewById(R.id.text_entry)).setOnEditorActionListener(new TextView.OnEditorActionListener() {
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                if (event != null && event.getAction() != KeyEvent.ACTION_DOWN) {
                    return false;
                }

                sendMessage();
                return true;
            }
        });

        footerView.findViewById(R.id.send_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                sendMessage();
            }
        });

        return layout;
    }