瀏覽單個文章
戰長
Major Member
 
戰長的大頭照
 

加入日期: Nov 2006
文章: 299
引用:
作者公不
本來用Code呈現Layout是打算這樣做

mylayou= new RelativeLayout(Main.this);
mylayou.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
mylayou.setX(0.0f);
mylayou.setY(0.0f);
mylayou.setId(10);;
mylayou.getLayoutParams().width=global_val.total_width;
mylayou.getLayoutParams().height=global_val.total_height;

LayoutInflater inflater = (LayoutInflater)Main.this.getSystemService(LAYOUT_INFLATER_SERVICE);

View alertView = inflater.inflate(10, null);


結果不行


既然你的View都要從java裡面造了
那不需要再從LayoutInflater拉
造出來直接塞到AlertDialog裡就好

類似這樣


代碼:
mylayou = new RelativeLayout(this);

TextView textView = new TextView(this);
textView.setText(R.string.app_name);
mylayou.addView(textView);

new AlertDialog.Builder(this).setView(mylayou).create().show();


不過建議你既然要造自己的dialog
其實可以直接寫一隻class繼承dialog下來客製化
以後使用上也會比較方便


另外硬體轉職軟體
等於是從lv1開始練起
白紙一張可能比大學生還差
這樣的情況下能拿到40k以上
其實已經算非常高薪了
舊 2014-06-01, 07:07 AM #4
回應時引用此文章
戰長離線中