0
我要創建適合throught屏幕的整個寬度ocntrols的酒吧蔓延,所以我用下面的代碼:的控制不是通過屏幕的寬度
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#d9dee1"
>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/buttonsborder"
>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="horizontal"
>
<Button
android:id="@+id/Chemo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chemo"
android:background="@drawable/firstbuttoncolorstyle"
android:textColor="@drawable/firstbuttontextstyle"
/>
<Button
android:id="@+id/inpatient"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="inpatient"
android:background="@drawable/firstbuttoncolorstyle"
android:textColor="@drawable/firstbuttontextstyle"
/>
<Button
android:id="@+id/Mgmt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mgmt"
android:background="@drawable/firstbuttoncolorstyle"
android:textColor="@drawable/firstbuttontextstyle"
/>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="@+id/PFinder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PFinder"
android:background="@drawable/secondbuttoncolorstyle"
android:textColor="@drawable/secondbuttontextstyle"
/>
<Button
android:id="@+id/Afinder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Afinder"
android:background="@drawable/secondbuttoncolorstyle"
android:textColor="@drawable/secondbuttontextstyle"
/>
<Button
android:id="@+id/Calender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Calender"
android:background="@drawable/secondbuttoncolorstyle"
android:textColor="@drawable/secondbuttontextstyle"
/>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="@+id/Profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Profile"
android:background="@drawable/thirdbuttoncolorstyle"
android:textColor="@drawable/secondbuttontextstyle"
/>
<Button
android:id="@+id/SODEOD"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SOD/EOD"
android:background="@drawable/thirdbuttoncolorstyle"
android:textColor="@drawable/secondbuttontextstyle"
/>
<Button
android:id="@+id/Clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Clear"
android:background="@drawable/thirdbuttoncolorstyle"
android:textColor="@drawable/secondbuttontextstyle"
/>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageButton
android:id="@+id/maillme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/mail" />
<ImageButton
android:id="@+id/callme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/call" />
</LinearLayout>
</LinearLayout>
<!-- the two columns part -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.80"
android:orientation="horizontal"
>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight=".80"
android:id="@+id/submenue"
>
<!-- this will be the menue list -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="First Name" />
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight=".20"
android:id="@+id/mainLayout"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="second Name" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
但結果是,如下圖像
如何通過畫面(彩色按鍵)的寬度傳播的控制,並使用此代碼
this.inpatient = (Button)this.findViewById(R.id.inpatient);
this.inpatient.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
String[] MainMenue = new String[] { "Chemo Unit", "Inpatient", "Patient tests","Management", "Instructions","Profile","Tools"};
// remove all controls
LinearLayout formLayout = (LinearLayout)findViewById(R.id.submenue);
formLayout.removeAllViews();
menueview = new ListView(getApplicationContext());
menueview.setVisibility(ListView.VISIBLE);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.RIGHT;
menueview.setLayoutParams(params);
menueview.setAdapter(new submenueadapter(menueview.getContext(), MainMenue));
formLayout.addView(menueview);
}
});
我就按一下按鈕的運行時間創建列表
如何增加字體和填充高度
我可以增加按鈕的大小位,也是它的工作非常好,那麼列表如何增加它 – AMH
對不起請,但我有問題,理解你。英語也不是我母親的語言,但請嘗試寫得更清楚並使用標點符號。您還希望增加哪個列表? –
,你可以在我的問題和下面的代碼中看到圖像,我動態地添加列表,但它出現如此之小,我可以增加它的字體大小,並使每個ist元素變大。這是我的第一個問題。我的第二個可以增加按鈕的大小(我的意思是高度) – AMH