Android 控件不会扩展到整个屏幕的宽度
我想创建适合整个屏幕宽度的控件栏,因此我使用了以下代码:Android 控件不会扩展到整个屏幕的宽度,android,android-layout,galaxy,Android,Android Layout,Galaxy,我想创建适合整个屏幕宽度的控件栏,因此我使用了以下代码: <?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:orientati
<?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>
如何增加字体和填充高度我认为有两种可能性。 如果要保持直线布局,第一个选项:
将子菜单布局的所有子菜单设置为\u width=“match\u parent”,并将其所有布局设置为1 第二种方法是,使用以下表格布局代替子菜单的线性布局:
<TableLayout android:id="@+id/TableLayout"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:stretchColumns="*">
<!-- Your menu items -->
<TableRow android:id="@+id/TableRow"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</TableRow>
</TableLayout>
我可以增加按钮大小位吗,而且效果很好,关于如何增加itExcuse me的列表,请告诉我,但我有一些问题需要了解。英语也不是我母亲的语言,但请尽量写得更清楚,使用标点符号。您还想增加哪个列表?正如您在我的问题中的图片和下面的代码中所看到的,我动态添加了列表,但它看起来太小了,我可以增加它的字体大小并使每个ist元素变大吗。这是我的第一个问题。我的第二个问题是,我可以增大按钮的大小(我指的是高度),您可以使用style=“@android:style/TextAppearance.Large”获得更大的字体大小,或者设置单个文本的aperance。我建议使用默认的android样式。您可以使用android:minHeight或绝对值使元素变大。同样的方法也适用于按钮,但我建议您使用包裹内容,因为最小高度和绝对值不适合不同的屏幕。
<TableLayout android:id="@+id/TableLayout"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:stretchColumns="*">
<!-- Your menu items -->
<TableRow android:id="@+id/TableRow"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</TableRow>
</TableLayout>