我爲移動設備(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