Opening a new screen from xml file text
Hey all I'm looking to edit my app so that when a text within an xml
file is selected, a new window opens. I've found various ways of making a new screen open via a class, but I need it done from a xml
file. My program as a tablayout
, and here is some of the stuff displayed within my first tab:
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView
android:id="@+id/ScrollView01"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<TextView
android:textColor="#FFFFFF"
android:text="First Header here"
android:textStyle="bold"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<TextView
android:textColor="#FFFFFF"
android:text="First body text here"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<View
android:layout_height="1dip"
android:background="#FFFFFF" />
<TextView
android:textColor="#FFFFFF"
android:text="Second header here"
android:textStyle="bold"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<TextView
android:textColor="#FFFFFF"
android:text="Second body text here"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<View
android:layout_height="1dip"
android:background="#FFFFFF" />
<TextView
android:textColor="#FFFFFF"
android:text="Third header here"
android:textStyle="bold"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<TextView
android:textColor="#FFFFFF"
android:text="Third body text here"
android:l开发者_如何学Goayout_width="fill_parent"
android:layout_height="wrap_content"
/>
</TableLayout>
</ScrollView>
</LinearLayout>
So basically I need it so that when a text is selected, a new screen pops up. As said the reason this specifically has to be done in xml
is because this is all apart of a tab layout, It would be great if the next within each tab could open a a new screen. Thanks.
So are you trying to get it to open an entire new layout outside of the tab view?
in which case all you need to do is set up a new xml file and on clicking the text call setContentView this will call upon the other xml file and open that page.
Or are you saying that on clicking it you wanna open another one of the tabs?
in which case your just looking to use a tab layout and tab widget:
http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
I'm just a bit confused as to what exactly your looking to do
I hope this helps
As far as I know this isn't possible without code. Unless you write your own textview component that had the code you need written in it. I.e you have to do this with code somewhere. You can specify custom properties that specify where you navigate to.
精彩评论