当前位置:网站首页>Layout use case
Layout use case
2022-06-24 01:57:00 【╱℡&▓】
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ActionBar.LayoutParams;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;
// Completely through code , To implement the interface
public class LayoutOne extends Activity {
private LinearLayout nameContainer = null;
private LinearLayout addressContainer = null;
private LinearLayout parentContainer = null;
// Rewriting methods
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
createNameContainer();
createAddressContainer();
createParentContainer();
setContentView(parentContainer);
}
// establish nameContainer
@SuppressLint("NewApi")
private void createNameContainer() {
nameContainer = new LinearLayout(this);
// layout With layout function , For example, set horizontal row 、 Vertical row , Can contain View, It can also include taking his place layout, So it is also a container
// stay Android I am learning , We use fill_parent, Include xml Use in fill_parent, stay API Level 8(Android
// 2.2) after , Change it to match_parent
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
nameContainer.setLayoutParams(layoutParams);
nameContainer.setOrientation(LinearLayout.HORIZONTAL);
// Set up the interior View
TextView txtView = new TextView(this);
txtView.setText(" full name :");
TextView valueView = new TextView(this);
valueView.setText(" Zhang San ");
nameContainer.addView(txtView);
nameContainer.addView(valueView);
}
// establish addressContainer
@SuppressLint("NewApi")
private void createAddressContainer() {
addressContainer = new LinearLayout(this);
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
addressContainer.setLayoutParams(layoutParams);
addressContainer.setOrientation(LinearLayout.VERTICAL);
TextView nameTextView = new TextView(this);
nameTextView.setText(" Detailed address :");
TextView valueTextView = new TextView(this);
valueTextView.setText(" Chemical fiber long way --- Dingjiazhuang ");
addressContainer.addView(nameTextView);
addressContainer.addView(valueTextView);
}
// establish rootView, And the first two container be similar , Different things addView It's not about joining the common view, But join layout
@SuppressLint("NewApi")
private void createParentContainer() {
parentContainer = new LinearLayout(this);
LayoutParams lParams = new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
parentContainer.setLayoutParams(lParams);
parentContainer.setOrientation(LinearLayout.VERTICAL);
parentContainer.addView(nameContainer);
parentContainer.addView(addressContainer);
}
}边栏推荐
- MySQL architecture
- The core battlefield of China US AI arms race: trillion level pre training model
- [JS reverse hundred examples] md5+aes encryption analysis of an easy payment password
- Digital case show ‖ made in China for the first time! Tencent cloud tdsql landed in Zhangjiagang bank and worked together to build financial business
- Make standardized tools in the cloud native era to realize efficient cloud R & D workflow
- Tencent host security (cloud mirror) arsenal: a sword to kill mining Trojans binaryai engine
- Tencent cloud double 11 Live Room activity rules
- Oracle sqlldr quick import and sqluldr2 quick export
- How does easynvr set the video recording to be saved for more than 30 days?
- Interviewer: let's talk about the snowflake algorithm. The more detailed, the better
猜你喜欢

I, a 27 year old female programmer, feel that life is meaningless, not counting the accumulation fund deposit of 430000

layer 3 switch

It's too difficult for me. Ali has had 7 rounds of interviews (5 years of experience and won the offer of P7 post)

Review of AI hotspots this week: the Gan compression method consumes less than 1/9 of the computing power, and the open source generator turns your photos into hand drawn photos

Stm32g474 infrared receiving based on irtim peripherals
![[SQL injection 13] referer injection foundation and Practice (based on burpseuite tool and sqli labs less19 target platform)](/img/b5/a8c4bbaf868dd20b7dc9449d2a4378.jpg)
[SQL injection 13] referer injection foundation and Practice (based on burpseuite tool and sqli labs less19 target platform)
![[SQL injection 12] user agent injection foundation and Practice (based on burpsuite tool and sqli labs LESS18 target machine platform)](/img/c8/f6c2a62b8ab8fa88bd2b3d8f35f592.jpg)
[SQL injection 12] user agent injection foundation and Practice (based on burpsuite tool and sqli labs LESS18 target machine platform)

BIM model example
随机推荐
How to build a video website? How much does it cost to build a video website?
SAP mm maintains inter company sto error -no delivery type defined for supplying
Devops learning notes (II)
Research Report on global and Chinese titanium concentrate market scale and investment prospects 2022-2028
It's too difficult for me. Ali has had 7 rounds of interviews (5 years of experience and won the offer of P7 post)
Kubesphere upgrade & enable plug-ins after installation
Clean system cache and free memory under Linux
[technical grass planting] how to batch check your server status? Cloud probe panel setup tutorial
Based on ARM embedded real-time streaming media service development and deployment, easygbs supports arm64 architecture
[technical grass planting] look what I did with my server!
Railway patrol system - Railway Intelligent Patrol communication system
Analysis report on market development trends and innovation strategies of China's iron and steel industry 2022-2028
Tcapulusdb Jun · industry news collection
Detailed explanation of SSH tunnel and stable intranet penetration using autossh
Can the server be restarted through the fortress machine? How are the fortress machines connected to the server
Embedded hardware development tutorial -- Xilinx vivado HLS case (3)
5、 Build freestyle projects and related knowledge
3、 Shell variable substring
4、 Variable assignment method
How does the education industry realize the TRTC interactive classroom apaas solution under the "double reduction policy"?