Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get clicked on views when i try to use custom layout #30

Closed
pishguy opened this issue Jun 18, 2016 · 2 comments
Closed

get clicked on views when i try to use custom layout #30

pishguy opened this issue Jun 18, 2016 · 2 comments

Comments

@pishguy
Copy link

pishguy commented Jun 18, 2016

in this sample:

new BottomSheet.Builder(activity)
        .setView(R.layout.custom_bottom_sheet_layout)
        .setListener(new BottomSheetListener() {
            @Override
            public void onSheetShown() {
            }
            @Override
            public void onSheetItemSelected(MenuItem menuItem) {
            }
            @Override
            public void onSheetDismissed(int i) {
            }
        }).show();

how can i get clicked on views? for example this is my own layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/bottom_sheet_click"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:gravity="center_horizontal">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@mipmap/ic_launcher" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="A Custom Layout" />

</LinearLayout>

it means get click event on bottom_sheet_click id

@pishguy pishguy changed the title get clicked view when i try to use custom layout get clicked on views when i try to use custom layout Jun 18, 2016
@Kennyc1012
Copy link
Owner

In that example, you would want to inflate the layout pre hand and configure it accordingly and past the View object into setView.

final View view = layoutInflayer.inflate(...);
view.setOnClickListener(...);
new BottomSheet.Builder(activity)
        .setView(view)
        .setListener(new BottomSheetListener() {
            @Override
            public void onSheetShown() {
            }
            @Override
            public void onSheetItemSelected(MenuItem menuItem) {
            }
            @Override
            public void onSheetDismissed(int i) {
            }
        }).show();

@pishguy
Copy link
Author

pishguy commented Jun 19, 2016

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants