package com.github.runly.riforum_android.ui.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;

import com.github.runly.riforum_android.R;
import com.github.runly.riforum_android.ui.adapter.PagerAdapter;
import com.github.runly.riforum_android.ui.fragment.SearchEntryFrag;
import com.github.runly.riforum_android.ui.fragment.SearchUserFrag;
import com.github.runly.riforum_android.utils.TxtUtils;

/**
 * Created by ranly on 17-3-23.
 */

public class SearchDetailActivity extends BaseActivity {
	private ViewPager viewPager;

	@Override
	protected void onCreate(@Nullable Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_search_detail);
		init();
		
		
		// 实现登录功能的方法
	        public void login() {
		    // 具体代码略去
	        }

	        Button loginButton = (Button) findViewByid(R.id.login_button);
	        loginButton.setOnClickListener(new OnClickListener() {
		    public void onClick(View v) {
		        login();
		    }
	        });

		
	}

	private void init() {
		initViewPagerAndTabs();
	}

	private void initViewPagerAndTabs() {
		viewPager = (ViewPager) findViewById(R.id.viewPager);
		viewPager.setOffscreenPageLimit(2);
		PagerAdapter pagerAdapter = new PagerAdapter(getSupportFragmentManager());
		pagerAdapter.addFragment(new SearchEntryFrag(), getString(R.string.search_tab_1));
		pagerAdapter.addFragment(new SearchUserFrag(), getString(R.string.search_tab_2));
		viewPager.setAdapter(pagerAdapter);

		TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout);
		tabLayout.setupWithViewPager(viewPager);
		TxtUtils.setUpIndicatorWidth(this, tabLayout, 50);
	}
}

@@ -818,304 +818,8 @@
 ();%0A
-%09%09%0A%09%09%0A%09%09// %E5%AE%9E%E7%8E%B0%E7%99%BB%E5%BD%95%E5%8A%9F%E8%83%BD%E7%9A%84%E6%96%B9%E6%B3%95%0A%09        public void login() %7B%0A%09%09    // %E5%85%B7%E4%BD%93%E4%BB%A3%E7%A0%81%E7%95%A5%E5%8E%BB%0A%09        %7D%0A%0A%09        Button loginButton = (Button) findViewByid(R.id.login_button);%0A%09        loginButton.setOnClickListener(new OnClickListener() %7B%0A%09%09    public void onClick(View v) %7B%0A%09%09        login();%0A%09%09    %7D%0A%09        %7D);%0A%0A%09%09%0A
 %09%7D%0A%0A

Update SearchDetailActivity.java