真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

Android筆記:代碼編寫布局

自己在shareSdk原有布局中添加一個(gè)加載過程的布局:

十多年的益陽網(wǎng)站建設(shè)經(jīng)驗(yàn),針對設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。營銷型網(wǎng)站的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整益陽建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)公司從事“益陽網(wǎng)站設(shè)計(jì)”,“益陽網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。

/** 新增:分享發(fā)送進(jìn)度 **/
private void setLoadingUI()
{
    // 頁面父布局
    pageLayout = new RelativeLayout(getContext());
    pageLayout.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
               
    // 填充編輯頁布局
    RelativeLayout.LayoutParams llPageLp = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    llPage.setLayoutParams(llPageLp);
    pageLayout.addView(llPage);
               
    // 加載過程布局
    loadReLayout = new RelativeLayout(getContext());
    loadReLayout.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    loadReLayout.setClickable(true);
    loadReLayout.setBackgroundColor(0x50000000);
    loadReLayout.setVisibility(View.GONE);
    pageLayout.addView(loadReLayout);
               
    // 加載過程中間布局
    LinearLayout loadCenterLayout = new LinearLayout(getContext());
    RelativeLayout.LayoutParams lcLp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lcLp.addRule(RelativeLayout.CENTER_IN_PARENT);
    loadCenterLayout.setPadding(8, 8, 8, 8);
    loadCenterLayout.setBackgroundColor(0xa5000000);
    loadCenterLayout.setOrientation(LinearLayout.HORIZONTAL);
    loadReLayout.addView(loadCenterLayout, lcLp);
               
    // 進(jìn)度條和加載中說明
    ProgressBar pb = new ProgressBar(getContext());
    pb.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    loadCenterLayout.addView(pb);
               
    TextView loadText = new TextView(getContext());
    LayoutParams ltlp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    ltlp.setMargins(8, 0, 0, 0);
    ltlp.gravity = Gravity.CENTER_VERTICAL;
    loadText.setLayoutParams(ltlp);
    loadText.setText("正在轉(zhuǎn)發(fā)分享...");
    loadText.setTextSize(16);
    loadText.setTextColor(Color.WHITE);
    loadCenterLayout.addView(loadText);
}

原布局部分代碼:

private void initPageView()
{
    // 編輯頁父布局
    llPage = new LinearLayout(getContext());
    llPage.setBackgroundColor(0xff323232);
    llPage.setOrientation(LinearLayout.VERTICAL);
                   
    // 新增:分享發(fā)送過程
    setLoadingUI();
                   
    // 標(biāo)題欄
    llTitle = new TitleLayout(getContext());
    llTitle.setBackgroundResource(R.drawable.title_back);
    llTitle.getBtnBack().setOnClickListener(this);
    llTitle.getTvTitle().setText(R.string.multi_share);
    llTitle.getBtnRight().setVisibility(View.VISIBLE);
    llTitle.getBtnRight().setText(R.string.share);
    llTitle.getBtnRight().setOnClickListener(this);
    llTitle.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    llPage.addView(llTitle);
                   
    FrameLayout flPage = new FrameLayout(getContext());
    LinearLayout.LayoutParams lpFl = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    lpFl.weight = 1;
    flPage.setLayoutParams(lpFl);
    llPage.addView(flPage);
                   
    // 頁面主體
    LinearLayout llBody = new LinearLayout(getContext());
    llBody.setOrientation(LinearLayout.VERTICAL);
    FrameLayout.LayoutParams lpLl = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    lpLl.gravity = Gravity.LEFT | Gravity.TOP;
    llBody.setLayoutParams(lpLl);
    flPage.addView(llBody);
                   
    // 別針圖片
    ivPin = new ImageView(getContext());
    ivPin.setImageResource(R.drawable.pin);
    int dp_80 = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 80);
    int dp_36 = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 36);
    FrameLayout.LayoutParams lpPin = new FrameLayout.LayoutParams(dp_80, dp_36);
    lpPin.topMargin = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 6);
    lpPin.gravity = Gravity.RIGHT | Gravity.TOP;
    ivPin.setLayoutParams(lpPin);
    flPage.addView(ivPin);
                   
    ImageView ivShadow = new ImageView(getContext());
    ivShadow.setBackgroundResource(R.drawable.title_shadow);
    ivShadow.setImageResource(R.drawable.title_shadow);
    FrameLayout.LayoutParams lpSd = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    ivShadow.setLayoutParams(lpSd);
    flPage.addView(ivShadow);
                   
    LinearLayout llInput = new LinearLayout(getContext());
    llInput.setMinimumHeight(cn.sharesdk.framework.utils.R.dipToPx(getContext(), 150));
    llInput.setBackgroundResource(R.drawable.edittext_back);
    LinearLayout.LayoutParams lpInput = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    int dp_3 = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 3);
    lpInput.setMargins(dp_3, dp_3, dp_3, dp_3);
    lpInput.weight = 1;
    llInput.setLayoutParams(lpInput);
    llBody.addView(llInput);
                   
                   
    //...
}

效果圖:

Android筆記:代碼編寫布局


分享名稱:Android筆記:代碼編寫布局
分享鏈接:http://weahome.cn/article/jojheh.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部