我为移动设备(minSdkVersion为9)和磨损(minSdkVersion为20)模块创建了一个新项目,我在想如何指定磨损轮廓和磨损的布局-square(我是否需要玩一下WatchViewStub类?)设备。就像我知道数据从掌上电脑发送到服装,但我怎样才能配置它,以便应用程序可以在磨损和磨损平面布局(特别是仅使用XML文件)上运行?指定移动和磨损模块的布局
这是我的手机\ ... \ activity_main.xml中:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Hello mobile world!"
android:id="@+id/textView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
至于磨损模块,一切都默认下的布局(我没有做任何修改),从而使包括,但不仅限于通过实施WatchViewStub类的充气器,用于圆形和方形屏幕的XML,它们应输出“Hello Square World!”。和“你好!回合世界”,分别与等
这里是我不变的磨损\ ... \ MainActivity:
package dpark.gameoflife;
import android.app.Activity;
import android.os.Bundle;
import android.support.wearable.view.WatchViewStub;
import android.widget.TextView;
public class MainActivity extends Activity {
private TextView mTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub stub) {
mTextView = (TextView) stub.findViewById(R.id.text);
}
});
}
}
...然后这就是我从穿虚拟仿真得到:
为什么我的一轮虚拟模拟器上面不会出现圆的?
谢谢,我非常感激。
谢谢先生! :) – DaveNOTDavid