Я пытаюсь показать PopUpWindow
или Dialog
при нажатии кнопки.Это показано, но проблема в том, что это не похоже на дизайн, и у него нет фона, похожего на обычный Dialog
Я хочу иметь Dialog
или Popup
в нижней части активности.Нужно ли писать, когда отображается Dialog
или PopUpWindow
или где?Или лучше создать Fragment
, а затем только назвать его Fragment
в Activity
.
Ниже приведены мои изображения
1.Является ли актуальный дизайн
2.Как это должно быть показано.
Ниже приведен мой код.
BookmarkActivity.class
ivShareMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LayoutInflater inflater = (LayoutInflater)
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
PopupWindow pw = new PopupWindow(
inflater.inflate(R.layout.dialog_fragment_share, null, false),
WindowManager.LayoutParams.MATCH_PARENT,
600,
true);
pw.showAsDropDown(ivShareMenu);
// The code below assumes that the root container has an id called 'main'
}
});
dialog_fragment_share.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical" android:id="@+id/layoutWithSharing"
android:layout_width="fill_parent" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_marginBottom="8.0dip">
<LinearLayout android:id="@+id/layoutPrivateMode"
android:background="@drawable/selector_right_round_white_btn"
style="@style/DialogShareAdvLayout">
<ImageView android:id="@+id/ivIncognitoMenu" android:src="@drawable/menu_incognito_on"
style="@style/DialogShareAdvIcon" />
<TextView android:layout_marginLeft="8.0dip" android:text="@string/WBVFontIncognito"
style="@style/DialogShareAdvTv" />
</LinearLayout>
<LinearLayout android:gravity="center" android:id="@+id/layoutNightMode"
android:background="@drawable/selector_white_round_btn" android:layout_width="fill_parent"
android:layout_marginLeft="12.0dip" android:layout_marginRight="12.0dip"
android:layout_weight="1.0" style="@style/DialogShareAdvLayout">
<ImageView android:id="@+id/ivNightMode" android:src="@drawable/night_button"
style="@style/DialogShareAdvIcon" />
<TextView android:ellipsize="end" android:id="@+id/tvNightMode"
android:layout_marginLeft="8.0dip" android:text="@string/WBVNightModeNight"
android:lines="1" style="@style/DialogShareAdvTv" />
</LinearLayout>
<LinearLayout android:id="@+id/ivTextSearch"
android:background="@drawable/selector_left_round_white_btn"
style="@style/DialogShareAdvLayout">
<ImageView android:src="@drawable/ic_search_black_24dp" style="@style/DialogShareAdvIcon" />
<TextView android:layout_marginLeft="8.0dip" android:text="@string/WBVFindInPage"
style="@style/DialogShareAdvTv" />
</LinearLayout>
</LinearLayout>
<LinearLayout android:orientation="vertical" android:background="@android:color/white"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal"
android:paddingLeft="8.0dip" android:paddingRight="16.0dip" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:minHeight="@dimen/share_layout_min_width">
<ImageView android:id="@+id/ivResetFont" android:background="@drawable/selector_gray_btn"
android:paddingLeft="8.0dip" android:paddingRight="8.0dip" android:clickable="true"
android:layout_width="42.0dip" android:layout_height="42.0dip"
android:src="@drawable/font_icn" />
<TextView android:textSize="13.0sp" android:textColor="@android:color/black"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="2.0dip" android:text="@string/WBVFontSize" />
<SeekBar android:id="@+id/seekBarFont" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:max="100" android:layout_weight="1.0" />
<TextView android:textSize="14.0sp" android:textColor="@android:color/black"
android:id="@+id/tvFontSize" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<View style="@style/GrayDivider" />
<LinearLayout android:id="@+id/shareLayout"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<LinearLayout android:id="@+id/vgAddFavour" style="@style/DialogShareLayout.vertical">
<ImageView android:src="@drawable/action_add_favorites"
style="@style/DialogShareImgViewShare.Big" />
<TextView android:text="@string/WBVAddToBookmarks" style="@style/DialogShareText.Big" />
</LinearLayout>
<LinearLayout android:id="@+id/vgAddReadable" style="@style/DialogShareLayout.vertical">
<ImageView android:src="@drawable/action_add_readinglist"
style="@style/DialogShareImgViewShare.Big" />
<TextView android:text="@string/WBVAddToReadingList"
style="@style/DialogShareText.Big" />
</LinearLayout>
<LinearLayout android:id="@+id/vgCopyLink" style="@style/DialogShareLayout.vertical">
<ImageView android:src="@drawable/action_copylink"
style="@style/DialogShareImgViewShare.Big" />
<TextView android:text="@string/WBVCopyLink" style="@style/DialogShareText.Big" />
</LinearLayout>
<LinearLayout android:id="@+id/vgShare" style="@style/DialogShareLayout.vertical">
<ImageView android:src="@drawable/action_share_url"
style="@style/DialogShareImgViewShare.Big" android:visibility="visible"/>
<TextView android:text="@string/WBVShare" style="@style/DialogShareText.Big" />
</LinearLayout>
</LinearLayout>
<View style="@style/GrayDivider" />
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="@dimen/share_layout_min_width">
<LinearLayout android:id="@+id/vgDownLoadList" android:paddingLeft="2.0dip"
android:layout_weight="11.0" style="@style/DialogShareLayout.horizontal">
<ImageView android:src="@drawable/action_download_list"
style="@style/DialogShareImgViewShare.Small" />
<TextView android:text="@string/WBVDownloadList" style="@style/DialogShareText.Small" />
</LinearLayout>
<LinearLayout android:id="@+id/vgSettings" android:layout_weight="11.0"
style="@style/DialogShareLayout.horizontal">
<ImageView android:paddingRight="4.0dip" android:src="@drawable/action_settings"
style="@style/DialogShareImgViewShare.Small" />
<TextView android:text="@string/SVTitle" style="@style/DialogShareText.Small" />
</LinearLayout>
<LinearLayout android:id="@+id/vgQuit" android:paddingRight="10.0dip"
android:layout_weight="12.0" style="@style/DialogShareLayout.horizontal">
<ImageView android:src="@drawable/action_quit"
style="@style/DialogShareImgViewShare.Small" />
<TextView android:text="@string/WBVQuit" style="@style/DialogShareText.Small" />
</LinearLayout>
</LinearLayout>
<View style="@style/GrayDivider" />
<Button android:id="@id/btnCancel" android:text="@string/WBVHideMenu"
style="@style/DialogLoadingButton" />
</LinearLayout>
</LinearLayout>
bookmark_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLayout"
style="@style/MainLayout">
<LinearLayout
android:id="@+id/linBrowser"
style="@style/BrowserLayout">
<FrameLayout
android:id="@+id/frameLayoutSearch"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<WebView
android:id="@+id/vpBrowsers"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:background="@color/downloadText" />
<ImageButton
android:id="@+id/My_btn"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="25dp"
android:layout_marginBottom="60dip"
android:background="@drawable/round_button"
android:src="@drawable/ic_share_white_24dp" />
</RelativeLayout>
<FrameLayout
android:id="@+id/ivBackground"
style="@style/ImageViewBlockWebView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone">
<FrameLayout
android:id="@+id/backPanel"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/gray_alpha">
<LinearLayout
android:id="@+id/layoutCopyPast"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4.0dp"
android:layout_marginTop="4.0dp"
android:layout_marginRight="4.0dp"
android:background="@android:color/transparent"
android:orientation="horizontal">
<Button
android:id="@+id/btnPaste"
style="@style/CopyPastPanelButtons"
android:text="@string/SearchPage_Panel_Paste" />
<View
android:id="@+id/firstDivider"
style="@style/CopyPastPanelDivider" />
<Button
android:id="@+id/btnCopy"
style="@style/CopyPastPanelButtons"
android:text="@string/SearchPage_Panel_Copy" />
<View
android:id="@+id/secondDivider"
style="@style/CopyPastPanelDivider" />
<Button
android:id="@+id/btnCut"
style="@style/CopyPastPanelButtons"
android:text="@string/SearchPage_Panel_Cut" />
</LinearLayout>
<LinearLayout
android:id="@+id/layoutExtension"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center|left"
android:layout_marginLeft="16.0dp"
android:layout_marginBottom="16.0dp"
android:orientation="horizontal" />
<ImageButton
android:id="@+id/ibShare"
style="@style/ImageButtonContext.Share" />
</FrameLayout>
<FrameLayout
android:id="@+id/trendMainLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone">
<include layout="@layout/trend_frame" />
<LinearLayout
android:id="@+id/layoutCopy"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4.0dp"
android:layout_marginTop="4.0dp"
android:orientation="horizontal"
android:visibility="gone">
<Button
android:id="@+id/btnPasteTrend"
style="@style/CopyPastPanelButtons"
android:text="@string/SearchPage_Panel_Paste" />
<View style="@style/CopyPastPanelEmpty" />
<View style="@style/CopyPastPanelEmpty" />
</LinearLayout>
</FrameLayout>
</FrameLayout>
<LinearLayout
android:id="@+id/linLayoutBrowserPanel"
android:layout_width="fill_parent"
android:layout_height="@dimen/search_height"
android:layout_gravity="bottom|center"
android:orientation="vertical">
<View
android:id="@+id/brPanelDivider"
android:layout_width="fill_parent"
android:layout_height="1.0px"
android:background="@color/browserPanel" />
<LinearLayout
android:id="@+id/searchTextLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/blue_title"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="2.0dp"
android:paddingTop="2.0dp"
android:paddingRight="2.0dp"
android:paddingBottom="2.0dp"
android:visibility="gone">
<FrameLayout
android:id="@+id/ivCloseTextSearch"
style="@style/ViewGroupButtonBrowser.Small">
<ImageView
style="@style/SearchBtnNext"
android:src="@drawable/selector_close_white_24dp" />
</FrameLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="2.0dp"
android:layout_marginRight="2.0dp"
android:layout_weight="1.0"
android:background="@drawable/white_round_button"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="8.0dp"
android:paddingTop="8.0dp"
android:paddingRight="8.0dp"
android:paddingBottom="8.0dp">
<EditText
android:id="@+id/etTextSearch"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:background="@android:color/transparent"
android:hint="@string/WBVFindInPage"
android:inputType="textNoSuggestions"
android:privateImeOptions="nm"
android:textColorHint="@color/gray"
android:textSize="14.0sp" />
<TextView
android:id="@+id/tvSearchCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8.0dp"
android:textColor="@color/gray"
android:textSize="14.0sp" />
</LinearLayout>
<FrameLayout
android:id="@+id/ivPrevFind"
style="@style/ViewGroupButtonBrowser.Small">
<ImageView
style="@style/SearchBtnNext"
android:src="@drawable/selector_keyboard_arrow_left_white_24dp" />
</FrameLayout>
<FrameLayout
android:id="@+id/ivNextFind"
style="@style/ViewGroupButtonBrowser.Small">
<ImageView
style="@style/SearchBtnNext"
android:src="@drawable/selector_keyboard_arrow_next_white_24dp" />
</FrameLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/linLayoutBrowserPanelSettings"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/linLayoutBrowserBack"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/blue_title"
android:orientation="horizontal">
<LinearLayout
style="@style/SideLayoutBrowserPanel"
android:layout_weight="6.0">
<FrameLayout
android:id="@+id/imgBtnPreviousPage"
style="@style/ViewGroupButtonBrowser.Side">
<ImageButton
android:id="@+id/ivPrevPage"
style="@style/ImageButtonBrowser"
android:src="@drawable/ic_arrowleft_browser_tr" />
</FrameLayout>
<FrameLayout
android:id="@+id/imgBtnNextPage"
style="@style/ViewGroupButtonBrowser.Side">
<ImageButton
android:id="@+id/ivNextPage"
style="@style/ImageButtonBrowser"
android:src="@drawable/ic_arrowright_browser_tr" />
</FrameLayout>
<FrameLayout
android:id="@+id/imgBtnVisHistory"
style="@style/ViewGroupButtonBrowser.Side">
<ImageButton
style="@style/ImageButtonBrowser"
android:src="@drawable/selector_visual_history" />
</FrameLayout>
<FrameLayout
android:id="@+id/imgBtnOpenReading"
style="@style/ViewGroupButtonBrowser.Side">
<ImageButton
style="@style/ImageButtonBrowser"
android:src="@drawable/selector_bookmarks_browser" />
</FrameLayout>
<FrameLayout
android:id="@+id/imgBtnShare"
style="@style/ViewGroupButtonBrowser.Side">
<ImageButton
android:id="@+id/ivShareMenu"
style="@style/ImageButtonBrowser"
android:layout_marginTop="-2.0dp"
android:paddingTop="2.0dp"
android:paddingBottom="0.0dp"
android:src="@drawable/selector_action_reading_list" />
</FrameLayout>
</LinearLayout>
<LinearLayout
style="@style/SideLayoutBrowserPanel"
android:layout_weight="11.0">
<LinearLayout
android:id="@+id/imgBtnRead"
style="@style/ViewGroupButtonBrowser.Side"
android:layout_height="fill_parent"
android:layout_weight="0.7"
android:gravity="center">
<ImageButton
android:id="@+id/imgBtnDef"
style="@style/ImageButtonBrowser"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="-12.0dp"
android:scaleType="fitCenter"
android:scaleX="@dimen/browser_switch_scale"
android:scaleY="@dimen/browser_switch_scale"
android:src="@drawable/toolbar_switch_mobilizer_off" />
<Switch
android:id="@+id/switcher"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:scaleX="@dimen/browser_switch_scale"
android:scaleY="@dimen/browser_switch_scale"
android:switchMinWidth="20.0dp"
android:textOff=""
android:textOn=""
android:thumb="@drawable/toolbar_switch_knob"
android:track="@drawable/switch_background" />
<ImageButton
android:id="@+id/imgBtnReadable"
style="@style/ImageButtonBrowser"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="-12.0dp"
android:scaleType="fitCenter"
android:scaleX="@dimen/browser_switch_scale"
android:scaleY="@dimen/browser_switch_scale"
android:src="@drawable/toolbar_switch_mobilizer_on" />
</LinearLayout>
<FrameLayout
android:id="@+id/imgBtnFullScreen"
style="@style/ViewGroupButtonBrowser.Side"
android:layout_marginRight="5.0dp"
android:paddingLeft="5.0dp">
<ImageButton
style="@style/ImageButtonBrowser"
android:src="@drawable/selector_fullscreen_on" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageButton
android:id="@+id/imgBtnFullScreenOff"
style="@style/ImgTransparentBtnBrowser"
android:layout_gravity="bottom|center|right"
android:layout_marginRight="10.0dp"
android:src="@drawable/ic_fullscreen_off" />
<ImageButton
android:id="@+id/imgBtnBack"
style="@style/ImgTransparentBtnBrowser"
android:layout_gravity="bottom|center|left"
android:layout_marginLeft="10.0dp"
android:src="@drawable/ic_fs_back" />
</FrameLayout>
</LinearLayout>
</LinearLayout>