Tag: android layout

使用LinearLayout将button放在屏幕底部?

我有下面的代码,我怎样才能使3个button在底部? <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="60dp" android:gravity="center" android:text="@string/observer" android:textAppearance="?android:attr/textAppearanceLarge" tools:context=".asdf" android:weight="1" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <Button android:id="@+id/button1" style="?android:attr/buttonStyleSmall" android:layout_width="145dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|center" android:text="1" /> <Button android:id="@+id/button2" style="?android:attr/buttonStyleSmall" android:layout_width="145dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|center" android:text="2" /> <Button android:id="@+id/button3" style="?android:attr/buttonStyleSmall" android:layout_width="145dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|center" android:text="3" /> </LinearLayout>

与底部中风的Android形状

我需要创build一个android形状,以便只有底部有中风(虚线)。 当我尝试以下时,笔画将中心的形状一分为二。 有谁知道如何去正确的? 笔画需要是底线/边框。 我正在使用该形状作为TextView的背景。 请不要紧,为什么我需要它。 <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <solid android:color="#1bd4f6" /> </shape> </item> <item> <shape android:shape="line" > <padding android:bottom="1dp" /> <stroke android:dashGap="10px" android:dashWidth="10px" android:width="1dp" android:color="#ababb2" /> </shape> </item> </layer-list>

避免传递null作为视图根(需要parsing膨胀布局的根元素上的布局参数)

为root工作室传递null给了我这个警告: 避免传递null作为视图根(需要parsing膨胀布局的根元素上的布局参数) 它在getGroupView显示一个空值。 请帮忙。 public class ExpandableListAdapter extends BaseExpandableListAdapter { private Context _context; private List<String> _listDataHeader; // header titles // child data in format of header title, child title private HashMap<String, List<String>> _listDataChild; public ExpandableListAdapter(Context context, List<String> listDataHeader, HashMap<String, List<String>> listChildData) { super(); this._context = context; this._listDataHeader = listDataHeader; this._listDataChild = listChildData; } @Override public […]

在XML布局中Android的<merge>标签的目的是什么?

我已经阅读了<merge />标签上的Romain Guy的post ,但我仍然不明白它的用处。 它是对<Frame />标签的一种replace,还是像这样使用: <merge xmlns:android="…."> <LinearLayout …> . . . </LinearLayout> </merge> 然后<include />在另一个文件中的代码?

android:我怎样才能在我的应用程序中实现第一次像Go Launcher的教程?

Go Launcher有一个很好的第一次教程。 股票ICS第一次运行非常相似。 我想在第一次启动的时候向用户学习我的应用程序。我可以在我的android应用程序中实现这个透明视图(与屏幕对象交互)吗?

Android布局编辑器ConstraintLayout

我正在运行Android Studio(最近安装了最新的stabel升级版本)当我使用Layout编辑器的时候,它似乎更喜欢ConstraintLayout当我移动两个小部件(一个TextView和一个button)时,它在编辑器上看起来没问题,但是当我试图在模拟器(Nexus 4)中使用它们,它们都在右上angular,在我的真实设备上也是如此,这里是否存在版本问题?

android多选ListView和Textview

我想创build像下面的列表视图。 checkbox| Textview | Textview | Textview | Textview | Textview | Textview | 所有数据都来自数据库,并在textview中设置。 我试过,但我有一些问题 当我selectcheckbox和滚动列表,然后它的automaticaly uncheked。 如果我select第一个checkbox,那么第五个是自动检查。 全部检查并取消全部检查 请帮我,我尝试了很多代码,但我不成功。 提前致谢。

只有当虚拟键盘在Android上打开时,才能移动文本视图

我的xml代码在这里, <?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/mainlayout" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:id="@+id/toplayout"> <ImageView android:layout_width="wrap_content" android:layout_height="100dp" android:src="@drawable/bg" /> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:id="@+id/bottomlayout"> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="Enter value" /> </LinearLayout> 当我执行,我有这样的, 执行后,当我input编辑文本的值,虚拟键盘打开,整个mainlayout向上滚动,我喜欢这个 但我除了,顶部布局不向上滚动,只有底部布局或textview向上滚动。 我期望像这样, 如何在打开虚拟键盘时仅滚动编辑视图。 ?

如何在DatePickerDialog Android的今天date之前禁用date?

我想在DatePickerDialog的今天date之前禁用date。我是新的android中,请build议我,我怎么能这样做。这里是我的代码,我已经写了DatePickerDialog final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { // TODO Auto-generated method stub myCalendar.set(Calendar.YEAR, year); myCalendar.set(Calendar.MONTH, monthOfYear); myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); updateLabel(val); } }; depart.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub new DatePickerDialog(this, date, myCalendar .get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)).show(); […]

android get activity返回null

我在一个Activity上使用Action Bar。 对于每个标签我显示不同的布局。 由于布局太重。 所以我将每个布局充满一个视图。 所以在每个选项卡上select public void onTabSelected(Tab tab, FragmentTransaction ft) { if (mView == null) { mView = LayoutInflater.from(mAct).inflate(mLayout, null); // mAct is Activity reference } mAct.setContentView(mView); for (int i = 0; i < mFrags.length; i++) { mFrags[i] = (LutronFragment) mAct.getFragmentManager() .findFragmentById(mIds[i]); if (mFrags[i] != null) { mFrags[i].setupHeader(); } } } public void […]