KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am very new to Android programming, and I have read everywhere and I can't seem to find any solution. Basic problem is that I have a TextView in a widget and I would like the text to scroll when the text is longer than the TextView layout_width. This is my code in the layout_widget.xml <TextView android:id="@+id/fact" android:layout_width="200dp" android:text="Loading... More text to see if it spans or not and want more" android:singleLine="true" android:ellipsize="marquee" android:marqueeRepeatLimit ="marquee_forever" android:scrollHorizontally="true" android:focusable="true" android:focusableInTouchMode="true" /> Now I read that I have to make the TextView to be on focus, which I have done. I have also read that you need to set the property setSelected(true) , and this is where I am struggling to set. In my default Activity (in the AndroidManifest.xml) I have this following code. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.widget_layout); findViewById(R.id.fact).setSelected(true); setContentView(R.layout.main); } The part below is used to set the Content to the widget_layout.xml and then set the TextView property for setSelected to true setContentView(R.layout.widget_layout); findViewById(R.id.fact).setSelected(true); I then return the ContentView back to main.xml Now I am guessing this is wrong and this is not the way it should be done. But I am wondering if it can be done. I also read that if you can override the Framework, you can put your own properties in, for example ScrollView, is this right as well? Also I am on SDK Versi
Tags (comma-separated)
Save Edits
Cancel