点線/破線の水平線を引こうとしています。私のテーブル (Android 4.0.4) では意図したとおりに表示され、Galaxy Nexus (Android 4.2.2) では実線で表示されます。それは Android 4.2.2 のバグですか、それとも何か間違っていますか? ご参考までに、このバグの原因を探しながら、コードを最小限に抑えました。
コードは次のとおりです。
package com.aschenbrenner.dashlinetest;
android.app.Activity をインポートします。android.os.Bundle をインポートします。
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
ライン描画可能な dashes.xmlt:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line">
<stroke android:width="5dip" android:color="#f5dcb2" android:dashWidth="2dip" android:dashGap="20dip"/>
</shape>
レイアウト activity_main.xml:
<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<ImageView
android:layout_width="match_parent"
android:layout_height="20dip"
android:src="@drawable/dashes"/>