मैं अपने MainActivity
में ToolBar
के नीचे शीर्ष पर एक SnackBar
दिखाने के लिए कोशिश कर रहा हूँ,शीर्ष पर एक Snackbar दिखाएँ (उपकरण पट्टी के नीचे)
मैं इस कोड की कोशिश की है:
mToolbar = (Toolbar) findViewById(R.id.toolbar);
Snackbar snack = Snackbar.make(findViewById(android.R.id.content), "Had a snack at Snackbar", Snackbar.LENGTH_LONG);
View view = snack.getView();
FrameLayout.LayoutParams params =(FrameLayout.LayoutParams)view.getLayoutParams();
params.gravity = Gravity.TOP;
view.setLayoutParams(params);
snack.show();
लेकिन SnackBar
शीर्ष पर दिखा रहा है, लेकिन Toolbar
से नीचे नहीं है।
मुख्य गतिविधि::
मैं Hangout
आवेदन की तरह करने के लिए कुछ इसी तरह चाहते
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/Coordinator"
xmlns:fab="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<ImageView
android:layout_width="75dp"
android:layout_height="28dp"
android:src="@drawable/athena"/>
</android.support.v7.widget.Toolbar>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar5"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal" />
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical" />
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
<com.melnykov.fab.FloatingActionButton
android:id="@+id/add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
fab:fab_colorNormal="@color/colorPrimary"
android:src="@drawable/ic_action_name9" />
</android.support.design.widget.CoordinatorLayout>
मैं TSnackbar उपयोग कर रहा हूँ, Snackbar उपकरण पट्टी
TSnackbar.make(findViewById(android.R.id.content),"Hello from TSnackBar.",TSnackbar.LENGTH_LONG).show();
से अधिक दिख रहा है
2 दिनों के काम खोने से पहले, कृपया एक बनें वेयर जो टीएसएनएकबार में एक बड़ी बग है जिसमें स्नैक्सबार जैसे ही आप गतिविधि छोड़ते हैं और/या जिस टुकड़े में रहते हैं, उतनी ही दिखाई नहीं देगी। मैं उत्पादन के लिए इस पर भरोसा नहीं करता। –
@ हेनरिक्यूडेसा 13 फरवरी, 18 को मुझे लगता है कि बग हल हो गया है – GGWP