我必須在固定位置(右上角)放置一個按鈕,這樣當我滾動屏幕/視圖時,該按鈕始終可見。它就像一個漂浮在視圖上的按鈕。該按鈕在滾動視圖中始終可見。滾動視圖上的Android浮動按鈕
1
A
回答
5
我做了一個假的應用程序和它的作品 這裏是佈局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout android:layout_width="match_parent" android:id="@+id/relativeLayout1" android:layout_height="wrap_content">
<ScrollView android:id="@+id/scrollView1" android:layout_height="fill_parent" android:layout_width="fill_parent">
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
<RatingBar android:id="@+id/ratingBar1" android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content"></RatingBar>
<Spinner android:layout_width="wrap_content" android:id="@+id/spinner1" android:layout_weight="1" android:layout_height="wrap_content"></Spinner>
<Spinner android:layout_width="wrap_content" android:id="@+id/spinner2" android:layout_height="wrap_content" android:layout_weight="1"></Spinner>
<SeekBar android:id="@+id/seekBar1" android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="match_parent"></SeekBar>
<QuickContactBadge android:layout_width="wrap_content" android:id="@+id/quickContactBadge1" android:layout_weight="1" android:layout_height="wrap_content"></QuickContactBadge>
<RatingBar android:id="@+id/ratingBar2" android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content"></RatingBar>
<RadioGroup android:layout_width="wrap_content" android:id="@+id/radioGroup1" android:layout_weight="1" android:layout_height="wrap_content">
<RadioButton android:text="RadioButton" android:layout_width="wrap_content" android:id="@+id/radio0" android:layout_height="wrap_content" android:checked="true"></RadioButton>
<RadioButton android:text="RadioButton" android:layout_width="wrap_content" android:id="@+id/radio1" android:layout_height="wrap_content"></RadioButton>
<RadioButton android:text="RadioButton" android:layout_width="wrap_content" android:id="@+id/radio2" android:layout_height="wrap_content"></RadioButton>
</RadioGroup>
<Spinner android:layout_width="match_parent" android:id="@+id/spinner3" android:layout_height="wrap_content" android:layout_weight="1"></Spinner>
<TextView android:layout_width="wrap_content" android:id="@+id/textView1" android:layout_height="wrap_content" android:layout_weight="1" android:text="TextView" android:textAppearance="?android:attr/textAppearanceMedium"></TextView>
<Button android:layout_width="wrap_content" android:text="Button" android:layout_height="wrap_content" android:layout_weight="1" android:id="@+id/button2"></Button>
<ProgressBar android:layout_width="wrap_content" android:layout_weight="1" android:id="@+id/progressBar1" android:layout_height="wrap_content" style="?android:attr/progressBarStyleHorizontal"></ProgressBar>
<RatingBar android:id="@+id/ratingBar3" android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content"></RatingBar>
<QuickContactBadge android:layout_width="wrap_content" android:id="@+id/quickContactBadge2" android:layout_weight="1" android:layout_height="wrap_content"></QuickContactBadge>
<Button android:layout_width="wrap_content" android:text="Button" android:layout_height="wrap_content" android:layout_weight="1" android:id="@+id/button3"></Button>
<CheckBox android:layout_width="wrap_content" android:text="CheckBox" android:id="@+id/checkBox1" android:layout_height="wrap_content" android:layout_weight="1"></CheckBox>
</LinearLayout>
</ScrollView>
<Button android:layout_height="wrap_content" android:text="Button" android:layout_width="wrap_content" android:id="@+id/button1"></Button>
</RelativeLayout>
</LinearLayout>
0
我想你正在使用XML文件來定義你的佈局。然後您需要定義ScrollView定義之外的按鈕,例如:
<ScrollView
...>
...
</ScrollView>
<Button
...>
</Button>
2
0
傢伙,我知道這是一箇舊的文章僅供參考,谷歌已經想出了一個庫,用於支持很多像浮動按鈕等很酷的東西。值得一看。 Google Design Support Lib
相關問題
- 1. 滾動視圖上的浮動操作按鈕?
- 2. 滾動視圖底部的Android按鈕
- 3. 按鈕滾動視圖。 jquery
- 4. 滾動視圖中的活動按鈕
- 5. 其他視圖上的浮動按鈕 - Android
- 6. 浮動動作按鈕滾動內容
- 7. 獲取按鈕滾動到Android上的GridView的底部視圖
- 8. Android按鈕自動滾動
- 9. 滾動視圖內滾動視圖android
- 10. Android按鈕浮動佈局
- 11. 如何使滾動視圖滾動即使按鈕子視圖被按下
- 12. 如何隱藏嵌套滾動上的浮動操作按鈕
- 13. 如何在android中滾動時添加浮動按鈕?
- 14. 刪除按鈕形式滾動視圖
- 15. 按鈕不出現在滾動視圖
- 16. 按鈕展開滾動視圖
- 17. 滾動視圖,按鈕事件交換
- 18. 浮動按鈕
- 19. 鎖定卡片視圖上的浮動按鈕
- 20. 屏幕上的浮動按鈕填充視圖?
- 21. Android的滾動視圖不滾動
- 22. Android滾動視圖
- 23. Android浮動按鈕沒有出現在視頻上方
- 24. 浮動按鈕不顯示在視圖中Android
- 25. 如何滾動在水平滾動視圖一個按鈕
- 26. UIScrollView與UIButtons - 滾動視圖不會滾動當按鈕開始
- 27. android水平滾動按鈕
- 28. 按鈕不可點擊的滾動視圖Android
- 29. Android的按鈕點擊不火內滾動視圖
- 30. android在水平滾動視圖中的對焦按鈕
非常感謝Lukap ....那就像我的魅力...... !! :) :) –