中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

去菲律賓做網(wǎng)站百度seo標(biāo)題優(yōu)化軟件

去菲律賓做網(wǎng)站,百度seo標(biāo)題優(yōu)化軟件,網(wǎng)站建設(shè)的雜志,wordpress獲取相關(guān)文章Android在任意Activity界面彈出一個自定義的對話框,效果如下圖所示: 準(zhǔn)備一張小圖片,右上角的小X圖標(biāo)64*64,close_icon.png,隨便找個小圖片代替; 第一步:樣式添加,注意:默認(rèn)在value…

Android在任意Activity界面彈出一個自定義的對話框,效果如下圖所示:

準(zhǔn)備一張小圖片,右上角的小X圖標(biāo)64*64,close_icon.png,隨便找個小圖片代替;

第一步:樣式添加,注意:默認(rèn)在values->thems下,如果版本較高,請至values->style.xml內(nèi)定義,將以下代碼添加在</resource>之前

    <style name="CustomDialog" parent="android:style/Theme.Dialog"><!--背景顏色及和透明程度--><item name="android:windowBackground">@android:color/transparent</item><!--是否去除標(biāo)題 --><item name="android:windowNoTitle">true</item><!--是否去除邊框--><item name="android:windowFrame">@null</item><!--是否浮現(xiàn)在activity之上--><item name="android:windowIsFloating">true</item><!--是否模糊--><item name="android:backgroundDimEnabled">true</item></style><!--自定義dialog背景彈框設(shè)置--><style name="mydialog" parent="android:style/Theme.Dialog"><!-- 背景透明,設(shè)置圓角對話框必須設(shè)置背景透明,否則四角會有背景色小塊--><item name="android:windowBackground">@android:color/transparent</item><!-- 沒有標(biāo)題 --><item name="android:windowNoTitle">true</item><!-- 背景模糊 --><item name="android:backgroundDimEnabled">true</item></style>

第二步:專門為它創(chuàng)建兩個類:DialogView +?DialogManager??

//DialogView.java
package com.example....//my packageimport android.app.Dialog;
import android.content.Context;
import android.view.Window;
import androidx.annotation.NonNull;public class DialogView extends Dialog {public DialogView(@NonNull Context context, int layout, int style, int gravity) {super(context, style);setContentView(layout);Window mWindow = getWindow();}
}
//DialogManager.java
package com.example....//my packageimport android.content.Context;
import android.view.Gravity;public class DialogManager {private static volatile DialogManager mInstance = null;private DialogManager() { }public static DialogManager getInstance() {if (mInstance == null) {synchronized (DialogManager.class) {if (mInstance == null) {mInstance = new DialogManager();}}}return mInstance;}public DialogView initView(Context context, int layout) {return new DialogView(context,layout, R.style.CustomDialog, Gravity.CENTER);}public DialogView initView(Context context,int layout,int gravity) {return new DialogView(context,layout, R.style.mydialog, gravity);} public void show(DialogView view) {//Showif (view != null) {if (!view.isShowing()) {view.show();}}}public void hide(DialogView view) {//Hideif (view != null) {if (view.isShowing()) {view.dismiss();}}}
}

第三步:給它創(chuàng)建樣式布局xml? ?my_dlg_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:background="@color/white"android:layout_height="match_parent"><LinearLayoutandroid:layout_width="match_parent"android:orientation="vertical"android:layout_marginTop="5dp"android:layout_height="wrap_content"><RelativeLayoutandroid:layout_width="match_parent"android:orientation="horizontal"android:layout_height="34dp"><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:gravity="center"android:orientation="horizontal"><TextViewandroid:layout_width="wrap_content"android:layout_height="25dp"android:text="MyDialog"android:textColor="@color/red"android:textSize="16sp"android:textStyle="bold" /></RelativeLayout><RelativeLayoutandroid:layout_alignParentRight="true"android:layout_width="wrap_content"android:orientation="horizontal"android:layout_gravity="right"android:layout_marginRight="10dp"android:layout_height="wrap_content"><ImageViewandroid:id="@+id/btn_cancel"android:layout_width="25dp"android:src="@drawable/close_icon"android:layout_margin="5dp"android:layout_height="25dp"/></RelativeLayout></RelativeLayout><Viewandroid:layout_width="match_parent"android:background="@color/gray"android:layout_height="1dp"/><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"><EditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_margin="10dp"android:hint="名稱:華山一區(qū)..."android:textSize="12sp"></EditText><EditTextandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_margin="10dp"android:textSize="12sp"android:hint="備注..."></EditText><Buttonandroid:layout_width="match_parent"android:layout_height="wrap_content"android:id="@+id/MY_Test_Add"android:background="@color/red"android:textColor="@color/white"android:layout_margin="10dp"android:paddingTop="10dp"android:paddingBottom="10dp"android:text="添加"></Button></LinearLayout></LinearLayout></LinearLayout>

//這里用到了剛才提到的close_icon,隨便替換為你的一個小圖標(biāo)

第四步:優(yōu)化-圓角(可有可無)

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"><corners android:radius="10dp"/><solid android:color="#FFEEEE" />
</shape>

//注意文件路徑res/drawable/shapes.xml,添加進(jìn)去別和你的東西沖突了,注意著點,邊框顏色隨便調(diào)整

第五步:已經(jīng)完成了,分兩步顯示它:初始化+顯示

import android.view.Gravity;//needed//myActivity(){.....private DialogView mDlgView;//公共變量
private ImageView btnCancel;//公共變量//protected void onCreate(Bundle savedInstanceState) {//my onCreate
//super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);mDlgView= DialogManager.getInstance().initView(this, R.layout.my_dlg_layout, Gravity.BOTTOM);//這里要注意,這個對話框的View要單獨綁定自己的布局
mDlgView.setCanceledOnTouchOutside(false);//這是設(shè)置區(qū)域外點擊是否取消顯示
btnCancel = mDlgView.findViewById(R.id.btn_cancel);//注意這個關(guān)閉圖片X,在對話框布局里了,而不是在當(dāng)前頁面布局,不可用this.findViewBy...btnCancel.setOnClickListener(new OnClickListener() {//給返回按紐添加點擊隱藏事件@Overridepublic void onClick(View view) {DialogManager.getInstance().hide(mDlgView);}
});

初始化完畢,在需要的地方進(jìn)行調(diào)用,比如你的按鈕被點擊了,直接在里調(diào)用這一句即可;

DialogManager.getInstance().show(mDlgView);

更多操作提示:

//mDlgView.dismiss(); //取消
//mDlgView.setCanceledOnTouchOutside(true);//允許區(qū)域外點擊關(guān)閉
//mDlgView.setCanceledOnTouchOutside(false);//禁止區(qū)域外點擊關(guān)閉//每次顯示的時候其實應(yīng)該清空Edittext里面的內(nèi)容,返回關(guān)閉X的圖標(biāo)的ID都能綁定了,相同的方法上面的任何子控件綁定都是小菜一碟,給個ID,用mDialogView.findViewById(R.....)就出來了//my_dlg_layout.xml 樣式隨便調(diào) padding是內(nèi)部邊距,margin是外邊距
//那一根線條的顏色也是可調(diào)的,高度為1的View,android:background="@color/gray",你甚至可以改為:android:background="#AAAAAA"舉一反三,祝你成功!

http://www.risenshineclean.com/news/54764.html

相關(guān)文章:

  • 大連城建設(shè)計研究院網(wǎng)站南昌seo顧問
  • 天津校園文化設(shè)計公司湖南網(wǎng)站建設(shè)推廣優(yōu)化
  • 中國做美國酒店的網(wǎng)站制作網(wǎng)站公司
  • 廣州黃埔區(qū)網(wǎng)站建設(shè)北京seo網(wǎng)站優(yōu)化公司
  • 做網(wǎng)站郴州百度信息流效果怎么樣
  • 涪城移動網(wǎng)站建設(shè)免費(fèi)推廣網(wǎng)站注冊入口
  • 做自己的購物網(wǎng)站網(wǎng)站推廣要點
  • 日照手機(jī)網(wǎng)站設(shè)計小學(xué)生抄寫新聞20字
  • 河南做網(wǎng)站公司排名sem代運(yùn)營托管公司
  • 微信高端網(wǎng)站建設(shè)百度愛采購平臺官網(wǎng)
  • 徐州企業(yè)網(wǎng)站排名優(yōu)化官網(wǎng)百度
  • 深圳品牌模板網(wǎng)站建設(shè)百度推廣助手怎么用
  • 扁平化 手機(jī)網(wǎng)站首頁5118大數(shù)據(jù)平臺官網(wǎng)
  • wordpress固定鏈自定義結(jié)構(gòu)企業(yè)關(guān)鍵詞優(yōu)化最新報價
  • 公司個人怎么做網(wǎng)絡(luò)推廣seo建站工具
  • 青島做網(wǎng)站方案網(wǎng)上營銷培訓(xùn)課程
  • 蕪湖做網(wǎng)站哪家好網(wǎng)站流量分析工具
  • 怎么在國外網(wǎng)站做推廣百度推廣的幾種方式
  • 重慶江北區(qū)網(wǎng)站建設(shè)公司seo網(wǎng)絡(luò)推廣是什么意思
  • 個人網(wǎng)站做公司網(wǎng)站企業(yè)網(wǎng)絡(luò)營銷案例
  • 秦皇島海三建設(shè)沒錢了奉化seo頁面優(yōu)化外包
  • wordpress做物流網(wǎng)站百度搜索引擎的特點
  • 給人做網(wǎng)站多少錢張掖seo
  • 濰坊地區(qū)網(wǎng)站制作免費(fèi)輿情監(jiān)測平臺
  • wordpress 文章推薦一篇福建優(yōu)化seo
  • 網(wǎng)站建設(shè)的目的和作用網(wǎng)站seo推廣排名
  • 阿里云企業(yè)網(wǎng)站怎么收費(fèi)百度競價排名多少錢
  • 網(wǎng)站建設(shè)調(diào)查報告范文seo是怎么優(yōu)化上去
  • 找人做網(wǎng)站做的很爛seo診斷服務(wù)
  • 網(wǎng)站運(yùn)營托管協(xié)議杭州網(wǎng)絡(luò)優(yōu)化公司排名