2011-03-22 46 views
5

Tôi muốn biết làm thế nào tôi có thể tạo ra một xung như ứng dụng trên Android Đây là một ảnh chụp màn hình: http://www.firstdroid.com/2010/11/17/top-android-app-pulse-news-reader/Làm thế nào tôi có thể tạo ra một 'xung' như giao diện người dùng cho một ứng dụng android

Một số điều:

  1. Nó có một số hàng 'nội dung theo chiều ngang.
  2. Mỗi 'hàng' có 'nội dung của ô.
  3. Tôi có thể 'quăng' sang trái và phải để xem nội dung theo chiều ngang.
  4. Khi đến cuối nội dung theo chiều ngang, nó sẽ tự động tải thêm nội dung.

Cảm ơn bạn.

Trả lời

2

Khái niệm đây chỉ là một ScrollView chứa một bó gồm Gallery bố cục sử dụng bộ điều hợp cuộn vô hạn như cwac-endless. Tôi nghĩ rằng với một chút công việc bạn có thể có thể có được tất cả để chơi độc đáo với nhau.

0

Có thể bạn có thể sử dụng như chế độ xem cuộn ngang với bố cục tùy chỉnh cho mỗi phần tử và sau đó như tải nội dung bạn muốn vào đó? Tôi không thực sự biết chỉ cần động não. Có vẻ như nó sẽ hoạt động với kiểu bố cục đó.

1

tôi chỉ ném một số ví dụ nhanh chóng và bẩn:

Đây là bố cục xml của bạn:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> 
    <TextView android:text="News One" android:id="@+id/textView1" android:layout_height="wrap_content" android:layout_width="wrap_content"></TextView> 
    <HorizontalScrollView android:id="@+id/horizontalScrollView1" 
     android:layout_width="wrap_content" android:layout_height="wrap_content"> 
     <LinearLayout android:id="@+id/linearLayout1" 
      android:orientation="horizontal" android:layout_height="wrap_content" 
      android:layout_width="wrap_content"> 
      <ImageView android:layout_width="wrap_content" android:id="@+id/imageView1" 
       android:layout_height="wrap_content" android:src="@drawable/image"></ImageView> 
      <ImageView android:layout_width="wrap_content" android:id="@+id/imageView2" 
       android:layout_height="wrap_content" android:src="@drawable/image"></ImageView> 
      <ImageView android:layout_width="wrap_content" android:id="@+id/imageView3" 
       android:layout_height="wrap_content" android:src="@drawable/image"></ImageView> 
      <ImageView android:layout_width="wrap_content" android:id="@+id/imageView4" 
       android:layout_height="wrap_content" android:src="@drawable/image"></ImageView> 
      <ImageView android:layout_width="wrap_content" android:id="@+id/imageView5" 
       android:layout_height="wrap_content" android:src="@drawable/image"></ImageView> 
      <ImageView android:layout_width="wrap_content" android:id="@+id/imageView6" 
       android:layout_height="wrap_content" android:src="@drawable/image"></ImageView> 
      <ImageView android:src="@drawable/image" 
       android:layout_width="wrap_content" android:id="@+id/imageView7" 
       android:layout_height="wrap_content"></ImageView> 
     </LinearLayout> 
    </HorizontalScrollView> 

    <TextView android:text="News Two" android:id="@+id/textView2" android:layout_height="wrap_content" android:layout_width="wrap_content"></TextView> 
    <HorizontalScrollView android:id="@+id/horizontalScrollView2" 
     android:layout_width="wrap_content" android:layout_height="wrap_content"> 
     <LinearLayout android:id="@+id/linearLayout2" 
      android:orientation="horizontal" android:layout_height="wrap_content" 
      android:layout_width="wrap_content"> 
      <ImageView android:layout_width="wrap_content" android:id="@+id/imageView21" 
       android:layout_height="wrap_content" android:src="@drawable/image"></ImageView> 
      <ImageView android:layout_width="wrap_content" android:id="@+id/imageView22" 
       android:layout_height="wrap_content" android:src="@drawable/image"></ImageView> 
      <ImageView android:layout_width="wrap_content" android:id="@+id/imageView23" 
       android:layout_height="wrap_content" android:src="@drawable/image"></ImageView> 
      <ImageView android:layout_width="wrap_content" android:id="@+id/imageView24" 
       android:layout_height="wrap_content" android:src="@drawable/image"></ImageView> 
      <ImageView android:layout_width="wrap_content" android:id="@+id/imageView25" 
       android:layout_height="wrap_content" android:src="@drawable/image"></ImageView> 
      <ImageView android:layout_width="wrap_content" android:id="@+id/imageView26" 
       android:layout_height="wrap_content" android:src="@drawable/image"></ImageView> 
      <ImageView android:src="@drawable/image" 
       android:layout_width="wrap_content" android:id="@+id/imageView27" 
       android:layout_height="wrap_content"></ImageView> 
     </LinearLayout> 
    </HorizontalScrollView> 
</LinearLayout> 

Để làm cho nó hoàn hảo, bạn có thể thêm biên giới để mỗi hình ảnh, vv, vv. Nhưng, bạn nên lấy ý tưởng từ bố cục này.

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