Tag: horizo​​ntalscrollview

水平冻结一个表格列

我有一个活动,我已经实现了一个tableview,表视图有一个标题和一个正文,表是水平和垂直可滚动的。 这是活动的源代码 : public class ReportListActivity extends Activity { TableLayout report_table; TableRow tr_data; int j = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_report_list); report_table=(TableLayout) findViewById(R.id.report_table); //—————Table Header———————————————– TableRow tr_head = new TableRow(this); tr_head.setId(10); tr_head.setBackgroundColor(Color.GRAY); tr_head.setLayoutParams(new LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); TextView label_sr_no = new TextView(this); label_sr_no.setId(20); label_sr_no.setText(“S.No.”); label_sr_no.setTextColor(Color.WHITE); label_sr_no.setPadding(5,5,5,5); tr_head.addView(label_sr_no);// add the column to the […]

包含在Horizo​​ntalScrollView中的TabWidget不会使用ViewPager滚动

我不得不使用TabHost代替ActionBarTabs并使它们可滚动我将TabWidget包装在HorizontalScrollView ,但HorizontalScrollView不会根据ViewPager滚动自身。 我尝试过几种不同的方式使用scrollTo和fullScroll,但它没有改变任何东西。 我需要做些什么才能使其正常工作? @Override public void onTabChanged(String tabId) { int position = mTabHost.getCurrentTab(); mViewPager.setCurrentItem(position); mHorizontalScrollView.scrollTo(position, 0); } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { mHorizontalScrollView.scrollTo(position, 0); }