我创建了以下布局.
<TableLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TableRow>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="Post As" />
<Spinner
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/ddlPostAs"
/>
</TableRow>
<TableRow>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="Expires In" />
<Spinner
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/ddlExpiryOn"
/>
</TableRow>
</TableLayout>
Run Code Online (Sandbox Code Playgroud)
其中android spinner根据数据更改其宽度.我想阻止它.
任何人都可以指导我如何实现这一目标吗?
任何帮助都会得到满足.
通过根据屏幕宽度固定宽度.
DisplayMetrics d = new DisplayMetrics();
getWindow().getWindowManager().getDefaultDisplay().getMetrics(d);
int wdt = d.widthPixels;
ddlpostas.getLayoutParams().width = wdt - 120;
ddlexpiryon.getLayoutParams().width = wdt - 120;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4486 次 |
| 最近记录: |