課程
/移動開發
/Android
/Android攻城獅的第二門課(第1季)
ViewPager如何設置頁面可以左右滑動而標題不動,想微信、QQ那樣標題不動,求大神告知!
2016-08-05
源自:Android攻城獅的第二門課(第1季) 10-4
正在回答
首先肯定是用的 是底部顯示標題。在L布局中再添加一個L布局,這個L布局里面有標題
<?xml?version="1.0"?encoding="utf-8"?> <LinearLayout?xmlns:android="http://schemas.android.com/apk/res/android" ????android:layout_width="match_parent" ????android:layout_height="match_parent" ????android:orientation="vertical"> ????<LinearLayout ????????android:layout_width="wrap_content" ????????android:layout_height="wrap_content"> ????????<TextView ????????????android:layout_gravity="center" ????????????android:textSize="30dp" ????????????android:layout_width="wrap_content" ????????????android:layout_height="wrap_content" ????????????android:text="標題"/> ????</LinearLayout> <android.support.v4.view.ViewPager ????android:id="@+id/pager" ????android:layout_width="wrap_content" ????android:layout_height="wrap_content" ????android:layout_gravity="center"> ???? ????<android.support.v4.view.PagerTabStrip ????????android:id="@+id/tab" ????????android:layout_width="wrap_content" ????????android:layout_height="wrap_content" ????????android:layout_gravity="bottom"> ????</android.support.v4.view.PagerTabStrip> ???? </android.support.v4.view.ViewPager> </LinearLayout>
然后效果圖:
滿意就采納吧
慕用9969177 提問者
舉報
本課程由淺入深地帶您學會Android的常用控件的開發和使用
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2016-08-05
首先肯定是用的 是底部顯示標題。在L布局中再添加一個L布局,這個L布局里面有標題
然后效果圖:
滿意就采納吧