2017-08-31 56 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

在相对布局的最后一个孩子也就是** ** –