Android 小部件在不同的手机中不兼容
我创建了一个显示WiFi状态和信息的小部件。我创建并测试了一款android版本为4.0的手机。当我用其他版本较低的手机进行测试时,小部件中使用的文本变得越来越小,分散了我在其中使用的所有组件。下面给出了我使用的布局xmlAndroid 小部件在不同的手机中不兼容,android,android-widget,Android,Android Widget,我创建了一个显示WiFi状态和信息的小部件。我创建并测试了一款android版本为4.0的手机。当我用其他版本较低的手机进行测试时,小部件中使用的文本变得越来越小,分散了我在其中使用的所有组件。下面给出了我使用的布局xml <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_wi
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:orientation="horizontal" >
<ImageView
android:id="@+id/wifi_background"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
<TextView
android:id="@+id/wifi_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="64dp"
android:layout_marginTop="13dp"
android:textSize="11dip" />
<TextView
android:id="@+id/wifi_on"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="64dp"
android:layout_marginTop="13dp"
android:textColor="@android:color/white"
android:textSize="11dip" />
<TextView
android:id="@+id/wifi_notconnected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="64dp"
android:layout_marginTop="30dp"
android:textColor="@android:color/white"
android:textSize="7dp" />
<ImageView
android:id="@+id/wifi_signal_strength"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/wifi_circle"
android:layout_width="66dp"
android:layout_height="76dp"
android:layout_marginLeft="1dp"
android:layout_marginTop="3dp"
android:background="@drawable/onpress_wifi_icon_circle_null"
android:src="@drawable/toggle" />
<ImageView
android:id="@+id/wifi_square"
android:layout_width="83dp"
android:layout_height="55dp"
android:layout_alignRight="@+id/wifi_circle"
android:layout_marginLeft="60dp"
android:layout_marginTop="8dp"
android:background="@drawable/onpress_network_info_squre_null"
android:src="@drawable/togglenetwork" />
</FrameLayout>
为什么不将整个布局xml代码放在一个方向为垂直的linera布局中
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
Your Current Layout xml code inside....
</LinearLayout>
您当前的布局xml代码在。。。。
试试看……我认为它应该很好用 图像视图的布局是填充父视图。可能你也需要在那里指定一个大小。使用
sp
作为textSize
而不是dip
或dp
。这没有任何区别:-(如果你能提供所需的版面图像,我想我可以帮助你使用XML。请编辑它。它说![在这里输入图像描述][1]就在
标记之后。当我说编辑它时,我的意思是要求您修复链接(图像描述):)请这样做,以便我知道您需要什么以及如何修复您的XML。我尝试过这样做,但那次只能查看背景图像。文本未显示在内部。