码迷,mamicode.com
首页 > 移动开发 > 详细

初学android之简易的网易页面

时间:2014-08-23 18:56:21      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:android   http   color   java   io   ar   2014   art   cti   

WangYiActivity.java:

public class WangYiActivity extends Activity implements OnClickListener{

 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.wangyi);
        TextView tv=(TextView)findViewById(R.id.panjiwen);
        TextView t=(TextView)findViewById(R.id.xianshi);
        tv.setOnClickListener(this);
        Intent intent=getIntent();
        String userName=intent.getStringExtra("userName");
        String name=intent.getStringExtra("name");
        int age=intent.getIntExtra("age", 0);
        t.setText("姓名:"+userName+",年龄"+age+""+name);
 }

 @Override
 public void onClick(View v) {
  Intent intent=new Intent(WangYiActivity.this,WangYi1Activity.class) ;
  startActivity(intent);
 }

}

WangYi1.java:

public class WangYi1Activity extends Activity {

 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.wangyi1);

 }

}

WangYi.xml:

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    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" >

    <TableRow android:background="#ff0000" >

        <ImageView
            android:id="@+id/a"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/night_base_pull_list_msg_indicator_arrow_up_drawable" />

        <ImageView
            android:id="@+id/b"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="64dp"
            android:src="@drawable/biz_widget_tag" />

        <Spinner
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="64dp"
            android:entries="@array/wangyi" />
    </TableRow>

    <GridLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#999"
        android:columnCount="5"
        android:rowCount="2" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="要闻"
            android:textSize="20dp" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="30dp"
            android:text="国内"
            android:textSize="20dp" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="50dp"
            android:text="国际"
            android:textSize="20dp" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="2"
            android:layout_gravity="center_horizontal|top"
            android:layout_marginLeft="120dp"
            android:layout_row="0"
            android:text="社会"
            android:textSize="20dp" />
    </GridLayout>

    <TableLayout>

        <TableRow android:layout_marginTop="10dp" >

            <ImageView
                android:layout_width="60dp"
                android:layout_height="60dp"
                android:src="@drawable/xijinpin" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="mumu宣布南京青奥会开幕"
                    android:textSize="15sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:text="mumu宣布南京青奥会今晚正式开幕"
                    android:textSize="10sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="160dp"
                    android:layout_marginTop="10dp"
                    android:text="1234跟帖"
                    android:textSize="10sp" />
            </LinearLayout>
        </TableRow>

        <TableRow android:layout_marginTop="10dp" >

            <ImageView
                android:layout_width="70dp"
                android:layout_height="60dp"
                android:scaleType="fitXY"
                android:src="@drawable/jinxiuxian" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="都教授将献唱,神秘女点燃圣火"
                    android:textSize="15sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:text="都教授将献唱主题曲,陈若琳点燃圣火"
                    android:textSize="10sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="160dp"
                    android:layout_marginTop="10dp"
                    android:text="5456跟帖"
                    android:textSize="10sp" />
            </LinearLayout>
        </TableRow>

        <TableRow android:layout_marginTop="10dp" >

            <ImageView
                android:layout_width="70dp"
                android:layout_height="60dp"
                android:scaleType="fitXY"
                android:src="@drawable/panjiwen" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="潘基文卖萌:我长得像都敏俊"
                    android:id="@+id/panjiwen"
                    android:textSize="15sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:text="此前彭丽媛访韩称mumu年轻时长得像都敏俊"
                    android:textSize="10sp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="160dp"
                    android:layout_marginTop="10dp"
                    android:text="5643跟帖"
                    android:textSize="10sp" />
            </LinearLayout>
        </TableRow>
    </TableLayout>

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#999"
        android:text="点击查看更多" />

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="160dp"
        android:background="#ffffff"
        android:text="回顶部↑" />
<TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/xianshi"
    />
</TableLayout>

WangYi1.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" >

    <TableLayout
        android:id="@+id/a"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <TableRow android:background="#ff0000" >

            <TextView
                android:id="@+id/a"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="&lt;" />

            <Spinner
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginLeft="220dp"
                android:entries="@array/wangyi" />
        </TableRow>
    </TableLayout>

    <TextView
        android:id="@+id/b"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/a"
        android:layout_marginTop="10dp"
        android:text="潘基文讲中文:我长得像都敏俊"
        android:textSize="20dp" />

    <TextView
        android:id="@+id/c"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/b"
        android:layout_marginTop="10dp"
        android:text="人民网2014-08-16 16:49" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/b"
        android:layout_marginTop="10dp"
        android:layout_toRightOf="@id/c"
        android:text="跟帖20876条"
        android:textColor="#ff0000" />

    <ImageView
        android:id="@+id/d"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_below="@id/c"
        android:layout_marginTop="10dp"
        android:scaleType="fitXY"
        android:src="@drawable/jinxiuxian" />
    <ImageView
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_above="@+id/textView2"
        android:layout_marginLeft="160dp"
        android:scaleType="fitXY"
        android:src="@drawable/panjiwen" />
   
    <TextView
        android:id="@+id/textView2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/d"
        android:layout_marginTop="10dp"
        android:text="       联合国秘书长潘基文在南京大学的对话中国青年活动上用中文自我介绍:
        大家好,我是潘基文,不是都敏俊,我们长得很像。全场大笑,掌声雷动。据悉,今晚潘基文和都敏俊都将出现在青奥会开幕式上" />
<TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/textView2"
        android:gravity="center_vertical">

        <TableRow android:background="#008000" >

            <TextView
                android:id="@+id/e"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:text="分享到" />
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/sns_qzone_icon"
                 />
             <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:src="@drawable/sns_renren_icon"
                />

             <ImageView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:src="@drawable/sns_sina_icon" />

              <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:src="@drawable/sns_weixin_icon"
                />
              
        </TableRow>
        <TableRow android:background="#ffffff"
            android:layout_marginTop="10dp"
            >
            <TextView
                 android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:text="网友跟帖"
                android:textSize="20dp"
                />
            <TextView
                 android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:text="20876"
                android:textColor="#ff0000"
                />
            <TextView
                 android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="发表评论"
                android:layout_marginLeft="60dp"
                android:textSize="20dp"
                />
        </TableRow>
       
    </TableLayout>
   <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#ffffff"
                android:layout_alignParentBottom="true"
                android:layout_alignParentRight="true"
                android:layout_marginLeft="200dp"
                android:text="回顶部↑" />
</RelativeLayout>

初学android之简易的网易页面

标签:android   http   color   java   io   ar   2014   art   cti   

原文地址:http://www.cnblogs.com/fanweichao/p/3931539.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!