我想製作一個按鈕或一個視圖,它能夠顯示出高於EditText
的 ,當點擊該按鈕時,會對該特定焦點EditText
執行某些操作。我不知道它是如何調用的,或者是否有任何3D派對庫。其他視圖上的浮動按鈕 - Android
-2
A
回答
0
這就是RelativeLayouts在這裏扮演很重要的角色,因爲您可以將視角置於另一個視角之上,並將焦點置於頂部,反之亦然。所以,首先你編譯Android的最新支持設計庫到本地的build.gradle文件來使用FAB,然後做這樣的事情的佈局文件:
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context="com.davenotdavid.stackoverflow.MainActivity">
<EditText
android:id="@+id/et1"
android:hint="HINT..."
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/et2"
android:hint="HINT..."
android:layout_below="@id/et1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/et3"
android:hint="HINT..."
android:layout_below="@id/et2"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content" />
</RelativeLayout>
...然後如果FAB也許測試已經集中在聚焦的EditText通過顯示吐司消息在您的onCreate(相對於EditText上的鍵盤彈出)()如下:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.fab).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "FAB clicked", Toast.LENGTH_SHORT).show();
}
});
}
+1
謝謝!你指出我需要的方向:) –
相關問題
- 1. 在視圖上的Android浮動按鈕
- 2. 滾動視圖上的Android浮動按鈕
- 3. 滾動視圖上的浮動操作按鈕?
- 4. 鎖定卡片視圖上的浮動按鈕
- 5. 浮動操作按鈕上方滾動視圖
- 6. Android:隱藏其他活動的按鈕
- 7. 如何使視圖在IME中的其他視圖之上浮動?
- 8. 屏幕上的浮動按鈕填充視圖?
- 9. Android應用程序中的浮動按鈕(尋呼視圖)
- 10. 按鈕上的android單獨視圖按
- 11. Android按鈕浮動佈局
- 12. 播放按鈕上的其他站點上的視頻按
- 13. 浮動按鈕
- 14. Android浮動按鈕沒有出現在視頻上方
- 15. 浮動按鈕不顯示在視圖中Android
- 16. 從其他視圖訪問表視圖的按鈕
- 17. 自定義視圖中浮動動作按鈕的填充
- 18. Android:借鑑其他視圖的活動
- 19. 其他視圖背後的Android動畫
- 20. 不顯示按鈕和其他活動的視圖的電子郵件視圖
- 21. 如何在android上的webview上顯示浮動按鈕android
- 22. 如何在編輯文本(搜索框)下方浮動列表視圖,並在其他視圖上(如按鈕)漂浮列表視圖
- 23. 按鈕顯示多個滾動視圖,導致其他按鈕佈局
- 24. 在其他按鈕上更改按鈕文本android
- 25. 的Android onTouch其他視圖
- 26. Openerp在點擊按鈕上點擊其他視圖
- 27. 如何在移動到其他視圖時禁用按鈕?
- 28. 直行到另一個視圖控制器(不產生浮動按鈕選項)上點擊浮動按鈕(ActionButton)
- 29. SlidingDrawer上方其他視圖
- 30. 從其他視圖隱藏按鈕視圖iphone sdk
可你只是張貼圖片或東西來闡述你真正想要的是什麼? –