2017-08-31 57 views
-2

我正在android中創建計算器應用程序。就像您在Android設備中看到的現代計算器一樣。我創建了一個TextView及以下,我的所有按鈕都present.I也希望包括trignometric功能,所以當按鍵佈局swipped,我想告訴trignometric功能,當它被刷回它顯示的數字buttons.The TextView的應保持不變的頂部。請你指導我如何做到這一點?滑動佈局的特定部分並向後滑動

回答

0

是的,你可以做到這一點。 這裏是一個例子,如何做到這一點

佈局範例

<?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <!-- Static content --> 
    <LinearLayout 
    android:id="@+id/ll_bottom" 
    android:layout_width="match_parent" 
    android:layout_height="100dp" 
    android:layout_alignParentBottom="true" 
    android:background="@color/holo_blue_light" 
    android:orientation="vertical" /> 

    <!-- ViewPager Indicator --> 
    <com.viewpagerindicator.LinePageIndicator 
    android:id="@+id/view_pager_indicator" 
    android:layout_width="fill_parent" 
    android:layout_height="20dp" 
    android:layout_above="@id/ll_bottom" 
    android:background="@color/holo_orange_light" 
    app:lineWidth="10dp" 
    app:selectedColor="#fff" 
    app:strokeWidth="10dp" 
    app:unselectedColor="#888888" /> 

    <!-- ViewPager containing fragments with different views --> 
    <android.support.v4.view.ViewPager 
    android:id="@+id/view_pager" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_above="@id/view_pager_indicator" 
    android:layout_alignParentTop="true" 
    android:background="@color/holo_red_light" /> 

</RelativeLayout> 

ViewPager 在藍色區域你把你不喜歡的 橙色區域用於由 ViewPagerIndicator改變靜態內容最後紅色區域是ViewPager的一個。這個區域是可以滑動的。

+0

我應該在哪裏把我的數字觀trignometric查看 –

+0

在相對佈局的最後一個孩子也就是** ** –