为什么出不来效果!
为什么我的就出来一行!activity_main的代码都一样!
为什么我的就出来一行!activity_main的代码都一样!
2016-07-21
package com.example.marqueetextviewdemo;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;
public class MarqueeText extends TextView{
public MarqueeText(Context context) {
super(context);
}
public MarqueeText(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public MarqueeText(Context context, AttributeSet attrs) {
super(context, attrs);
}
public boolean isFocused(){
return true;
}
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.example.marqueetextviewdemo.MarqueeText
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="@string/hello_world" />
<com.example.marqueetextviewdemo.MarqueeText
android:layout_below="@id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:focusable="true"
android:layout_marginTop="10dp"
android:focusableInTouchMode="true"
android:text="@string/hello_world" />
</RelativeLayout>
举报