In our previous blog, we described how the app list interface was finished on the homepage. This listview and its adapter will be reused in the interface behind us, so this is a relatively important one, and in this blog we have finished the part of the app-specific interface, and when we click on each item of the ListView, Will come into our interface to make a specific introduction to the app.
Let's take a look first.
This small interface is still relatively simple.
First we need to finish the above navigation bar, which contains the left arrow and the middle text and color.
We create a new file below the Res/layout directory. Named Activity_app_detail.xml
Let's take a look at the code in the navigation bar above:
<relativelayout android:id="@+id/rl_app_detail_title"Android:layout_width="Fill_parent"android:layout_height="@dimen/bar_height"android:layout_alignparenttop="true"Android:background="@color/mbarcolor"> <textview android:id="@+id/tv_app_detail_back"Android:layout_width="@dimen/bake_size"android:layout_height="@dimen/bake_size"Android:layout_centervertical="true"android:layout_marginleft="10DP"Android:background="@drawable/button_back"android:clickable="true"android:gravity="Center"/> <textview android:id="@+id/tv_app_detail_appname"Android:layout_width="Wrap_content"android:layout_height="Wrap_content"Android:layout_centerhorizontal="true"Android:layout_centervertical="true"android:gravity="Center"android:text="Details"Android:textcolor="@color/white"Android:textsize="24SP"android:textstyle="Bold"/> </relativelayout>
Below we look at the definition of color mbarcolor, which is defined in the Res/color/color.xml file. The code is as follows:
<color name="mbarcolor">#29abe2</color>
Let's define the display screen that shows the app images and other information later. We continue with the following code in the file Activity_app_detail.xml file:
<ScrollViewandroid:layout_width="Match_parent"android:layout_height ="Match_parent"android:layout_below="@id/rl_app_detail_title" > <relativelayoutandroid:layout_width="Match_parent"android:layout_height ="Match_parent" > <relativelayoutandroid:id="@+id/rl_general"android:layout_width= "Match_parent" android:layout_height="Wrap_content"android:background="@color/mbarcolor " > <imageview a Ndroid:id = "@+id/iv_app_icon" an Droid:layout_width = "wrap_content" android:layout_height =" wrap_content " android:layout_marginleft =" 10DP " android:layout_margintop =" 5DP " android:background =" @drawable/icon4 "/> <relativelayout android:id =" @+id/rl_tv_detail " android:layout_width =" match_parent " android:layout_height =" wrap_content " android:layout_marginleft =" 3dip " android:layout_margintop = "5DP" android:layout_torightof =; <textview android:id =" @+id/tv_app_name " android:layout_width =" wrap_content " android:layout_height =" wrap_content " android:singleline = "true" android:text = "cool Music" android:textcolor =" @color/white " android:textsize = "18SP" /> <linearlayout android:id =" @+id/ll_rank " android:layout_width =" wrap_content " android:layout_height =" wrap_content " android:layout_below = "@id/tv_app_name" android:layout_margintop = "3DP" android:orientation = "horizontal" > <ImageViewandroid:layout_width= "15dp"android:layout_height=" 15DP "android:background=" @drawable/star_on " /> <ImageViewandroid:layout_width="15DP"android:layout_height= "15DP" android:background="@drawable/star_on" /> <ImageViewandroid:layout_width= "15dp"android:layout_height=" 15DP "android:background=" @drawable/star_on " /> <ImageViewandroid:layout_width="15DP"android:layout_height= "15DP" android:background="@drawable/star_on" /> <ImageViewandroid:layout_width= "15dp"android:layout_height=" 15DP "android:background=" @drawable/star_off " /> </linearlayout> <relativelayout android:id =" @+id/rl_down_size " android:layout_width =" match_parent " android:layout_height = "wrap_content" android:layout_below = "@id/ll_rank" android:layout_margintop = "3DP" ; <TextViewandroid:id= "@+id/tv_app_size"android:layout_width=" Wrap_content "android:layout_height=" Wrap_content "android:text=" 18.92M " Android:textcolor="@color/white"android:textsize="12SP" > </TextView> <TextView Android:id="@+id/tv_down_count" Android:layout_width="Wrap_content" Android:layout_height="Wrap_content" Android:layout_marginleft="8DP" Android:layout_torightof="@id/tv_app_size" Android:text="57,288 Downloads" Android:textcolor="@color/white" android:textsize="12SP"/> </relativelayout> </relativelayout> <Viewandroid:layout_width="Match_parent"android:layout_height= "0DP" android:layout_below= "@id/iv_app_icon"android:layout_margintop="5DP" /> </relativelayout> </relativelayout> </ScrollView>
Here we define the ScrollView, because there is a lot of content to be added back.
Well, here we have our interface defined, and then. We create an activity to display the interface, and the ListView on the homepage is added to the listener to jump to this interface.
Create appdetailinfoactivity in Src/com.sdu.activities, inherited from Baseactivity.
PackageCom.sdu.activities;ImportCOM.SDU.ANDROIDMARKET.R;ImportAndroid.view.View;ImportAndroid.view.Window;ImportAndroid.widget.TextView; Public class appdetailinfoactivity extends baseactivity { PrivateTextView Tv_app_detail_back;@Override Public void Initwidget() {//TODO auto-generated method stubRequestwindowfeature (Window.feature_no_title); Setcontentview (R.layout.activity_app_detail); Tv_app_detail_back = (TextView) Findviewbyid (r.id.tv_app_detail_back); Tv_app_detail_back.setonclicklistener ( This); }@Override Public void Widgetclick(View v) {//TODO auto-generated method stub Switch(V.getid ()) { CaseR.id.tv_app_detail_back:appdetailinfoactivity. This. Finish (); Break; } } }
Next, let's take a look at the monitor of the ListView in Homeactivity.
lv_apps.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override publicvoidonItemClick(AdapterView<?
> parent, View view, intlong id) { // TODO Auto-generated method stub new Intent(HomeActivity.this,AppDetailInfoActivity.class); startActivity(intent); } });
OK, so the overall work is over. That's right. Don't forget to register the activity in the Androidmanifest.xml.
<activity android:name="com.sdu.activities.AppDetailInfoActivity" > </activity>
In this way, the small interface is over, and we are finished. Check it out. In the following article, we continue to complete the introduction of our app-specific interface.
App Details Interface-01