2011-09-28 34 views
18

Tôi đang làm việc trên một ứng dụng Android nhỏ. Một phần của những gì tôi cần cho ứng dụng android này là có một mạng lưới có thể cuộn ngang và dọc. Tuy nhiên, cột ngoài cùng bên trái cần phải được cố định (luôn luôn trên màn hình và không phải là một phần của cuộn ngang). Tương tự, dòng tiêu đề trên cần phải được đông lạnh (không phải là một phần của cuộn dọc)Tạo bảng/lưới có cột cố định và tiêu đề cố định

bức tranh này sẽ hy vọng mô tả rõ điều này nếu ở trên không làm quá nhiều ý nghĩa:

Example of what I would like to do

chìa khóa:

  1. trắng: không di chuyển ở tất cả
  2. Blue: cuộn theo chiều dọc
  3. đỏ: cuộn theo chiều ngang
  4. Tím: cuộn cả theo chiều dọc và chiều ngang

Để làm một trong những khía cạnh là đủ dễ dàng, và tôi đã làm như vậy. Tuy nhiên, tôi gặp khó khăn trong việc đưa cả hai thứ nguyên này vào hoạt động. (ví dụ, tôi có thể lấy phần dưới cùng là tất cả màu xanh, hoặc tôi có thể nhận được phần bên phải là tất cả màu đỏ, nhưng không hoàn toàn như trên) Mã tôi có bên dưới và về cơ bản sẽ sản xuất như sau:

What I have!

result_grid.xml:

<RelativeLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:background="@color/lightGrey"> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:layout_below="@id/summaryTableLayout" 
     android:layout_weight="0.1" 
     android:layout_marginBottom="50dip" 
     android:minHeight="100dip"> 
     <ScrollView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:scrollbars="vertical"> 
      <LinearLayout 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal"> 
       <TableLayout 
        android:id="@+id/frozenTable" 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content" 
        android:layout_marginTop="2dip" 
        android:layout_marginLeft="1dip" 
        android:stretchColumns="1" 
        /> 

       <HorizontalScrollView 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_toRightOf="@id/frozenTable" 
        android:layout_marginTop="2dip" 
        android:layout_marginLeft="4dip" 
        android:layout_marginRight="1dip"> 

        <TableLayout 
         android:id="@+id/contentTable" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:stretchColumns="1"/> 
       </HorizontalScrollView> 
      </LinearLayout> 
     </ScrollView> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent" 
     android:orientation="vertical" 
     android:layout_weight="0.1" 
     android:layout_alignParentBottom="true"> 
     <Button 
      android:id="@+id/backButton" 
      android:layout_height="wrap_content" 
      android:layout_width="fill_parent" 
      android:text="Return"/> 
    </LinearLayout> 
</RelativeLayout> 

mã Java:

private boolean showSummaries; 

private TableLayout summaryTable; 
private TableLayout frozenTable; 
private TableLayout contentTable; 

public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.result_grid); 

    Button backButton = (Button)findViewById(R.id.backButton); 
    frozenTable = (TableLayout)findViewById(R.id.frozenTable); 
    contentTable = (TableLayout)findViewById(R.id.contentTable); 

    ArrayList<String[]> content; 

    // [Removed Code] Here I get some data from getIntent().getExtras() that will populate the content ArrayList 
    PopulateMainTable(content); 
} 

private void PopulateMainTable(ArrayList<String[]> content) { 
    // [Removed Code] There is some code here to style the table (so it has lines for the rows) 

    for (int i = 0; i < content.size(); i++){ 
     TableRow frozenRow = new TableRow(this); 
      // [Removed Code] Styling of the row 
     TextView frozenCell = new TextView(this); 
     frozenCell.setText(content.get(i)[0]); 
     // [Removed Code] Styling of the cell 
     frozenRow.addView(frozenCell); 
     frozenTable.addView(frozenRow); 

     // The rest of them 
     TableRow row = new TableRow(this); 
     // [Renoved Code] Styling of the row 
     for (int j = 1; j < content.get(0).length; j++) { 
      TextView rowCell = new TextView(this); 
      rowCell.setText(content.get(i)[j]); 
      // [Removed Code] Styling of the cell 
      row.addView(rowCell); 
     } 

     contentTable.addView(row); 
    } 
} 

Đây là những gì nó trông giống như:

Look, headers!

Vì vậy, đây là những gì nó trông giống như với một chút cuộn ngang

Bah, no headers!

Đây là những gì nó trông giống như khi di chuyển theo chiều dọc, lưu ý rằng bạn bị mất các tiêu đề! Đây là một vấn đề!

Hai điều cuối cùng cần lưu ý!

Trước hết, tôi không thể tin rằng điều này không tồn tại ở một nơi nào đó. (Tôi không sở hữu một chiếc Android, vì vậy tôi đã không thể tìm kiếm các ứng dụng có thể làm điều này). Tuy nhiên, tôi đã tìm kiếm ít nhất hai ngày trong StackOverflow và trên Internet để tìm kiếm một giải pháp cho GridView hoặc TableLayout sẽ cung cấp cho tôi những gì tôi muốn làm và chưa tìm ra giải pháp. Như xấu hổ như tôi sẽ được cho đã bỏ lỡ nó, nếu ai đó biết về một nguồn tài nguyên ra có mô tả làm thế nào để làm điều này, tôi sẽ biết ơn! Thứ hai, tôi đã cố gắng "buộc" một giải pháp cho điều này, trong đó tôi đã thêm hai LinearLayouts, một trong đó nắm bắt phần "Tiêu đề" của lưới mà tôi muốn tạo và một phần khác cho phần "nội dung" ở dưới cùng của lưới tôi muốn tạo. Tôi có thể đăng mã này, nhưng điều này đã khá dài và tôi hy vọng rằng điều tôi ngụ ý là hiển nhiên.Điều này một phần làm việc nhưng vấn đề ở đây là các tiêu đề và cột nội dung không bao giờ xếp hàng. Tôi muốn sử dụng getWidth() và setMinimumWidth() trên TextViews trong TableRows, nhưng như được mô tả here dữ liệu này không thể truy cập được trong quá trình onCreate (và cũng không thể truy cập được trong onPostCreate). Tôi đã không thể tìm ra cách để có được điều này để làm việc, và một giải pháp trong lĩnh vực này cũng sẽ tuyệt vời!

Nếu bạn đã thực hiện điều này từ đầu đến cuối, danh tiếng dành cho bạn!

+1

+1 để viết đẹp –

+0

@Kevek: "Tôi không thể tin rằng điều này không tồn tại ở đâu đó" - nó có thể tồn tại, nhưng tôi không biết nó được đóng gói như một thành phần tái sử dụng được, là mã nguồn mở. – CommonsWare

+0

@CommonsWare có thể rất tốt, nhưng vì tôi thường đánh dấu các ghi chú của các thuật toán/thuật toán UI mà tôi mong đợi sử dụng trong tương lai hoặc suy nghĩ về nền tảng/ngôn ngữ tôi hy vọng rằng có thể ai đó tương tự, và đã tìm thấy điều này trước đây. Có thể không! – Kevek

Trả lời

9

Khoảng một tuần trước, tôi đã xem lại vấn đề này và đưa ra giải pháp. Giải pháp này yêu cầu tôi phải thực hiện nhiều cài đặt chiều rộng thủ công cho các cột trong lưới này và tôi cho rằng điều này cực kỳ nhỏ trong ngày và tuổi này. Thật không may, tôi cũng đã tiếp tục tìm kiếm một giải pháp toàn diện hơn bản địa cho nền tảng Android, nhưng tôi đã không biến bất cứ điều gì lên.

Sau đây là mã để tạo cùng một lưới này, nên bất kỳ ai theo dõi tôi đều cần đến nó. Tôi sẽ giải thích một số chi tiết thích hợp hơn bên dưới!

Cách bố trí: grid.xml:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@color/lightGrey"> 

<TableLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 
    android:layout_marginBottom="2dip" 
    android:layout_weight="1" 
    android:minHeight="100dip"> 
    <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal"> 
     <TableLayout 
       android:id="@+id/frozenTableHeader" 
       android:layout_height="wrap_content" 
       android:layout_width="wrap_content" 
       android:layout_marginTop="2dip" 
       android:layout_marginLeft="1dip" 
       android:stretchColumns="1" 
       /> 

     <qvtcapital.mobile.controls.ObservableHorizontalScrollView 
      android:id="@+id/contentTableHeaderHorizontalScrollView" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@id/frozenTableHeader" 
      android:layout_marginTop="2dip" 
      android:layout_marginLeft="4dip" 
      android:layout_marginRight="1dip"> 

      <TableLayout 
       android:id="@+id/contentTableHeader" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:stretchColumns="1"/> 
     </qvtcapital.mobile.controls.ObservableHorizontalScrollView> 
    </LinearLayout> 
    <ScrollView 
     android:id="@+id/verticalScrollView" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:scrollbars="vertical"> 
     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal"> 
      <TableLayout 
       android:id="@+id/frozenTable" 
       android:layout_height="wrap_content" 
       android:layout_width="wrap_content" 
       android:layout_marginTop="2dip" 
       android:layout_marginLeft="1dip" 
       android:stretchColumns="1" 
       /> 

      <qvtcapital.mobile.controls.ObservableHorizontalScrollView 
       android:id="@+id/contentTableHorizontalScrollView" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@id/frozenTable" 
       android:layout_marginTop="2dip" 
       android:layout_marginLeft="4dip" 
       android:layout_marginRight="1dip"> 

       <TableLayout 
        android:id="@+id/contentTable" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:stretchColumns="1"/> 
      </qvtcapital.mobile.controls.ObservableHorizontalScrollView> 
     </LinearLayout> 
    </ScrollView> 
</TableLayout> 

Các hoạt động: Grid.java:

public class ResultGrid extends Activity implements HorizontalScrollViewListener { 

private TableLayout frozenHeaderTable; 
private TableLayout contentHeaderTable; 
private TableLayout frozenTable; 
private TableLayout contentTable; 

Typeface font; 
float fontSize; 
int cellWidthFactor; 

ObservableHorizontalScrollView headerScrollView; 
ObservableHorizontalScrollView contentScrollView; 

public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.result_grid); 

    font = Typeface.createFromAsset(getAssets(), "fonts/consola.ttf"); 
    fontSize = 11; // Actually this is dynamic in my application, but that code is removed for clarity 
    final float scale = getBaseContext().getResources().getDisplayMetrics().density; 
    cellWidthFactor = (int) Math.ceil(fontSize * scale * (fontSize < 10 ? 0.9 : 0.7)); 

    Button backButton = (Button)findViewById(R.id.backButton); 
    frozenTable = (TableLayout)findViewById(R.id.frozenTable); 
    contentTable = (TableLayout)findViewById(R.id.contentTable); 
    frozenHeaderTable = (TableLayout)findViewById(R.id.frozenTableHeader); 
    contentHeaderTable = (TableLayout)findViewById(R.id.contentTableHeader); 
    headerScrollView = (ObservableHorizontalScrollView) findViewById(R.id.contentTableHeaderHorizontalScrollView); 
    headerScrollView.setScrollViewListener(this); 
    contentScrollView = (ObservableHorizontalScrollView) findViewById(R.id.contentTableHorizontalScrollView); 
    contentScrollView.setScrollViewListener(this); 
    contentScrollView.setHorizontalScrollBarEnabled(false); // Only show the scroll bar on the header table (so that there aren't two) 

    backButton.setOnClickListener(backButtonClick); 

    InitializeInitialData(); 
} 

protected void InitializeInitialData() { 
    ArrayList<String[]> content; 

    Bundle myBundle = getIntent().getExtras(); 
    try { 
     content = (ArrayList<String[]>) myBundle.get("gridData"); 
    } catch (Exception e) { 
     content = new ArrayList<String[]>(); 
     content.add(new String[] {"Error", "There was an error parsing the result data, please try again"}); 
     e.printStackTrace(); 
    } 

    PopulateMainTable(content); 
} 

protected void PopulateMainTable(ArrayList<String[]> content) { 
    frozenTable.setBackgroundResource(R.color.tableBorder); 
    contentTable.setBackgroundResource(R.color.tableBorder); 

    TableLayout.LayoutParams frozenRowParams = new TableLayout.LayoutParams(
      TableLayout.LayoutParams.WRAP_CONTENT, 
      TableLayout.LayoutParams.WRAP_CONTENT); 
    frozenRowParams.setMargins(1, 1, 1, 1); 
    frozenRowParams.weight=1; 
    TableLayout.LayoutParams tableRowParams = new TableLayout.LayoutParams(
      TableLayout.LayoutParams.WRAP_CONTENT, 
      TableLayout.LayoutParams.WRAP_CONTENT); 
    tableRowParams.setMargins(0, 1, 1, 1); 
    tableRowParams.weight=1; 

    TableRow frozenTableHeaderRow=null; 
    TableRow contentTableHeaderRow=null; 
    int maxFrozenChars = 0; 
    int[] maxContentChars = new int[content.get(0).length-1]; 

    for (int i = 0; i < content.size(); i++){ 
     TableRow frozenRow = new TableRow(this); 
     frozenRow.setLayoutParams(frozenRowParams); 
     frozenRow.setBackgroundResource(R.color.tableRows); 
     TextView frozenCell = new TextView(this); 
     frozenCell.setText(content.get(i)[0]); 
     frozenCell.setTextColor(Color.parseColor("#FF000000")); 
     frozenCell.setPadding(5, 0, 5, 0); 
     if (0 == i) { frozenCell.setTypeface(font, Typeface.BOLD); 
     } else { frozenCell.setTypeface(font, Typeface.NORMAL); } 
     frozenCell.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize); 
     frozenRow.addView(frozenCell); 
     if (content.get(i)[0].length() > maxFrozenChars) { 
      maxFrozenChars = content.get(i)[0].length(); 
     } 

     // The rest of them 
     TableRow row = new TableRow(this); 
     row.setLayoutParams(tableRowParams); 
     row.setBackgroundResource(R.color.tableRows); 
     for (int j = 1; j < content.get(0).length; j++) { 
      TextView rowCell = new TextView(this); 
      rowCell.setText(content.get(i)[j]); 
      rowCell.setPadding(10, 0, 0, 0); 
      rowCell.setGravity(Gravity.RIGHT); 
      rowCell.setTextColor(Color.parseColor("#FF000000")); 
      if (0 == i) { rowCell.setTypeface(font, Typeface.BOLD); 
      } else { rowCell.setTypeface(font, Typeface.NORMAL); } 
      rowCell.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize); 
      row.addView(rowCell); 
      if (content.get(i)[j].length() > maxContentChars[j-1]) { 
       maxContentChars[j-1] = content.get(i)[j].length(); 
      } 
     } 

     if (i==0) { 
      frozenTableHeaderRow=frozenRow; 
      contentTableHeaderRow=row; 
      frozenHeaderTable.addView(frozenRow); 
      contentHeaderTable.addView(row); 
     } else { 
      frozenTable.addView(frozenRow); 
      contentTable.addView(row); 
     } 
    } 

    setChildTextViewWidths(frozenTableHeaderRow, new int[]{maxFrozenChars}); 
    setChildTextViewWidths(contentTableHeaderRow, maxContentChars); 
    for (int i = 0; i < contentTable.getChildCount(); i++) { 
     TableRow frozenRow = (TableRow) frozenTable.getChildAt(i); 
     setChildTextViewWidths(frozenRow, new int[]{maxFrozenChars}); 
     TableRow row = (TableRow) contentTable.getChildAt(i); 
     setChildTextViewWidths(row, maxContentChars); 
    } 
} 

private void setChildTextViewWidths(TableRow row, int[] widths) { 
    if (null==row) { 
     return; 
    } 

    for (int i = 0; i < row.getChildCount(); i++) { 
     TextView cell = (TextView) row.getChildAt(i); 
     int replacementWidth = 
       widths[i] == 1 
         ? (int) Math.ceil(widths[i] * cellWidthFactor * 2) 
         : widths[i] < 3 
          ? (int) Math.ceil(widths[i] * cellWidthFactor * 1.7) 
          : widths[i] < 5 
           ? (int) Math.ceil(widths[i] * cellWidthFactor * 1.2) 
           :widths[i] * cellWidthFactor; 
     cell.setMinimumWidth(replacementWidth); 
     cell.setMaxWidth(replacementWidth); 
    } 
} 

public void onScrollChanged(ObservableHorizontalScrollView scrollView, int x, int y, int oldX, int oldY) { 
    if (scrollView==headerScrollView) { 
     contentScrollView.scrollTo(x, y); 
    } else if (scrollView==contentScrollView) { 
     headerScrollView.scrollTo(x, y); 
    } 
} 

Quan điểm cuộn người nghe (để treo hai trở lên): HorizontalScrollViewListener.java:

public interface HorizontalScrollViewListener { 
    void onScrollChanged(ObservableHorizontalScrollView scrollView, int x, int y, int oldX, int oldY); 
} 

Lớp scrollview mà thực hiện nghe này: ObservableHorizontalScrollView.java:

public class ObservableHorizontalScrollView extends HorizontalScrollView { 
    private HorizontalScrollViewListener scrollViewListener=null; 

    public ObservableHorizontalScrollView(Context context) { 
     super(context); 
    } 

    public ObservableHorizontalScrollView(Context context, AttributeSet attrs, int defStyle) { 
     super(context, attrs, defStyle); 
    } 

    public ObservableHorizontalScrollView(Context context, AttributeSet attrs) { 
     super(context, attrs); 
    } 

    public void setScrollViewListener(HorizontalScrollViewListener scrollViewListener) { 
     this.scrollViewListener = scrollViewListener; 
    } 

    @Override 
    protected void onScrollChanged(int x, int y, int oldX, int oldY) { 
     super.onScrollChanged(x, y, oldX, oldY); 
     if (null!=scrollViewListener) { 
      scrollViewListener.onScrollChanged(this, x, y, oldX, oldY); 
     } 
    } 
} 

Phần thực sự quan trọng của việc này là loại ba lần:

  1. Các ObservableHorizontalScrollView cho phép bảng header và bảng nội dung để di chuyển đồng bộ. Về cơ bản, điều này cung cấp tất cả chuyển động ngang cho lưới.
  2. Cách thức chúng liên kết là bằng cách phát hiện chuỗi lớn nhất sẽ nằm trong cột. Việc này được thực hiện vào cuối PopulateMainTable().Trong khi chúng tôi đang đi qua từng TextViews và thêm chúng vào các hàng, bạn sẽ nhận thấy rằng có hai mảng maxFrozenCharsmaxContentChars theo dõi giá trị chuỗi lớn nhất mà chúng ta đã thấy. Vào cuối PopulateMainTable(), chúng tôi lặp qua từng hàng và cho mỗi ô chúng tôi đặt chiều rộng tối thiểu và tối đa dựa trên chuỗi lớn nhất mà chúng tôi đã thấy trong cột đó. Điều này được xử lý bởi setChildTextViewWidths.
  3. Mục cuối cùng làm cho tác phẩm này là sử dụng phông chữ đơn cách. Bạn sẽ nhận thấy rằng trong onCreate tôi đang tải một phông chữ consola.ttf, và sau đó áp dụng nó cho mỗi TextViews của lưới hoạt động như các ô trong lưới. Điều này cho phép chúng tôi chắc chắn rằng văn bản sẽ không được hiển thị lớn hơn chúng tôi đã đặt chiều rộng tối thiểu và tối đa thành bước trước đó. Tôi đang làm một chút fanciness ở đây, những gì với toàn bộ cellWidthFactor và kích thước tối đa của cột đó. Điều này thực sự là các chuỗi nhỏ hơn sẽ phù hợp với chắc chắn, trong khi chúng ta có thể giảm thiểu khoảng trắng cho các chuỗi lớn hơn (đối với hệ thống của tôi) sẽ không phải là tất cả các chữ cái viết hoa. Nếu bạn gặp sự cố khi sử dụng tính năng này và bạn có các chuỗi không vừa với kích thước cột bạn đã đặt, đây là nơi bạn muốn chỉnh sửa mọi thứ. Bạn sẽ muốn thay đổi biến số replacementWidth bằng một số công thức khác để xác định chiều rộng ô, chẳng hạn như 50 * widths[i] sẽ là khá lớn! Nhưng sẽ để lại cho bạn một số lượng khoảng trắng trong một số cột. Về cơ bản, tùy thuộc vào những gì bạn có kế hoạch đưa vào lưới của bạn, điều này có thể cần phải được tinh chỉnh. Trên đây là những gì làm việc cho tôi.

Tôi hy vọng điều này sẽ giúp người khác trong tương lai!

+0

viết và trả lời hay, tôi đang đối mặt với một vấn đề tương tự như của bạn. Tôi đã đi qua giải pháp của bạn nhưng không thể thực hiện nó trong mã của tôi. Bạn có thể giúp tôi với vấn đề của tôi không? Đây là liên kết http://stackoverflow.com/questions/16140735/table-view-look-and-usability-enhancement – kittu88

1

Off đỉnh đầu của tôi, đây là cách tôi sẽ tiếp cận này:

1) Tạo một giao diện với một phương pháp mà hoạt động của bạn sẽ thực hiện để nhận được tọa độ cuộn và scrollview của bạn có thể gọi trở lại khi một cuộn xảy ra:

public interface ScrollCallback { 
    public void scrollChanged(int newXPos, int newYPos); 
} 

2) Thực hiện điều này trong hoạt động của bạn để di chuyển hai scrollviews hạn chế đến vị trí mà scrollview chính chỉ cuộn tới:

@Override 
public void scrollChanged(int newXPos, int newYPos) { 
    mVerticalScrollView.scrollTo(0, newYPos); 
    mHorizontalScrollView.scrollTo(newXPos, 0); 
} 
.210

3) Subclass scrollview để ghi đè lên các phương pháp onScrollChanged(), và thêm một biến phương pháp và thành viên gọi lại để hoạt động:

private ScrollCallback mCallback; 

//... 

@Override 
protected void onScrollChanged (int l, int t, int oldl, int oldt) { 
    mCallback.scrollChanged(l, t); 
    super.onScrollChanged(l, t, oldl, oldt); 
} 

public void setScrollCallback(ScrollCallback callback) { 
    mCallback = callback; 
} 

4) Thay thế các cổ phiếu scrollview trong XML của bạn với lớp và gọi mới của bạn setScrollCallback(this) trong onCreate().

+0

Tôi chỉ đọc lại câu hỏi của bạn; bạn đề cập rằng bạn đã có giải pháp làm việc _partially_ và trong các nhận xét bạn nói rằng bạn có ý tưởng về cách tiếp cận _might_ hoạt động. Nếu bạn có một giải pháp bạn nên đăng nó, nó sẽ hữu ích cho những người gặp phải vấn đề tương tự. – jvergeldedios

+0

Đây là giải pháp làm việc * một phần *. Trong đó, mọi thứ hoạt động, tôi có thể có hai chế độ xem cuộn được liên kết (theo chiều ngang) và một chế độ xem cuộn chính, nhưng căn chỉnh không hoạt động. Điều đó nói rằng, tôi đã thực sự quay trở lại vấn đề này và sửa chữa nó vào một ngày khác và tôi dự định đăng giải pháp, mặc dù tôi thực sự hy vọng rằng Android sẽ hỗ trợ tốt hơn cho những gì tôi coi là một vấn đề rất chuẩn. Đáng buồn thay, nền tảng dường như thiếu trong lĩnh vực này. – Kevek

+0

Tôi có một số vấn đề với việc triển khai mã của bạn, bạn có thể vui lòng giúp tôi với vấn đề của tôi không? Đây là liên kết http://stackoverflow.com/questions/18440471/android-grid-view-concomitant-scrolling-delay –

Các vấn đề liên quan