我想减少附加布局中文本(User12,5电影,改进2.5%)之间的行间距.
这是下面的xml(我尝试删除singleLine ="true"语句并尝试将其设置为false):
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:orientation="horizontal" >
<ImageView
android:id="@+id/icon"
android:src="@drawable/icon"
android:layout_width="36dip"
android:layout_height="36dip"
android:layout_margin="5dip"
android:scaleType="center"
android:layout_gravity="center_vertical" />
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="7.5">
<TextView
android:id="@+id/scoreDesc"
android:text="User12"
android:layout_marginLeft="5dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Small"
android:singleLine="true"
android:ellipsize="marquee"
android:layout_weight="1"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/scoreDesc"
android:text="5 movies"
android:layout_marginLeft="5dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Small"
android:singleLine="true"
android:ellipsize="marquee"
android:layout_weight="1"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/scoreDesc"
android:text="2.5% improved"
android:layout_marginLeft="5dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Small"
android:singleLine="true"
android:ellipsize="marquee"
android:layout_weight="1"
android:layout_gravity="center_vertical" />
</LinearLayout>
<TextView
android:id="@+id/scoreNum"
android:text="32"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center"
android:textSize="20sp"
android:textStyle="bold"
android:paddingLeft="10dip"
android:paddingRight="60dip"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我正在使用AChartEngine来显示几天的平均值(如果可能,则为2个月).我想提供一个人和一个群体之间的比较.在这一点上,我正在研究如何在x轴上提供日期(即2011年12月15日或2011年12月11日甚至12月15日12月15日).
我不知道如何在AchartEngine中这样做; 如果没有照片,我的文档有点难以理解(对不起).我喜欢这样的东西:使用AChartEngine库来绘制图形,无法获得不同x轴值的值
这是我的代码:
private void setupHistoryChart() {
XYMultipleSeriesRenderer renderer = getBarDemoRenderer();
setChartSettings(renderer);
Intent intent = ChartFactory.getBarChartIntent(this, getBarDemoDataset(), renderer, Type.DEFAULT);
startActivity(intent);
}
public XYMultipleSeriesRenderer getBarDemoRenderer() {
XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
renderer.setAxisTitleTextSize(15);
renderer.setChartTitleTextSize(18);
renderer.setLabelsTextSize(12);
renderer.setLegendTextSize(15);
renderer.setMargins(new int[] {20, 30, 15, 0});
SimpleSeriesRenderer r = new SimpleSeriesRenderer();
r.setColor(Color.BLUE);
renderer.addSeriesRenderer(r);
return renderer;
}
private void setChartSettings(XYMultipleSeriesRenderer renderer) {
renderer.setChartTitle("History");
renderer.setChartTitleTextSize((float) 14.0);
renderer.setXTitle("Day");
renderer.setXLabelsAlign(Align.LEFT);
renderer.setYLabelsAlign(Align.LEFT);
renderer.setBarSpacing(0.5);
renderer.setZoomEnabled(true);
renderer.setZoomRate(0.2f);
renderer.setYTitle("Unit)");
renderer.setXAxisMin(1.0);
if(AppStatus.mDayMap.size() == 0){
renderer.setXAxisMax(3.0);
renderer.setYAxisMax(10.0);
}else{
renderer.setXAxisMax(AppStatus.mDayMap.size());
// Get the max Integer …
Run Code Online (Sandbox Code Playgroud) 我正在尝试从支持OAuth 1.0的站点访问用户数据而不进行回调.我正在使用路标库,但我无法检索访问令牌,因为我尝试连接的站点不需要用户指定验证码.要从路标获取访问令牌,我似乎需要提供某种类型的验证码.
我的问题:有没有办法绕过这一步并仍然获得访问令牌?
否则,我收到消息"授权失败(服务器回复401)".我已经设置/注册了我的客户.
我已经包含了我现有的代码以及有关我正在尝试连接的网站的更多详细信息(http://www.stepgreen.org - 您必须创建一个帐户才能查看以下信息):
身份验证:OAuth
StepGreens首选的身份验证方法是OAuth.有关OAuth的更多信息,请访问OAuth.net.我们目前支持没有回调的OAuth 1.0.
您需要一些其他信息来配置您选择的OAuth库:
请求请求令牌:/ oauth/request_token请求访问令牌:/ oauth/access_token授权URL:/ oauth/authorize要与客户端一起使用OAuth,请记住设置客户端.
public static void main(String[] args) throws Exception{
OAuthConsumer consumer = new DefaultOAuthConsumer( CONSUMER_KEY, CONSUMER_SECRET,
SignatureMethod.HMAC_SHA1);
OAuthProvider provider = new DefaultOAuthProvider(consumer, REQUEST_TOKEN_URL,
ACCESS_TOKEN_URL, AUTHORIZE_URL);
System.out.println("Fetching request token...");
String authUrl = provider.retrieveRequestToken(OAuth.OUT_OF_BAND);
System.out.println("Request token: " + consumer.getToken());
System.out.println("Token secret: " + consumer.getTokenSecret());
System.out.println("Now visit:\n" + authUrl + "\n... and grant this app authorization");
System.out.println("Enter the verification code and hit ENTER when you're done:");
BufferedReader br = new …
Run Code Online (Sandbox Code Playgroud) 我遇到一个问题,我的滚动条与布局中的元素重叠.我想滚动条出现在编辑框之后:.将滚动条添加到xml文件的不同部分时,我收到错误消息,我理解这意味着scrollview必须是根元素.因此,我的代码看起来像这样(当我觉得滚动视图应该出现在第一个线性布局和/或编辑框之后):
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/db1_root"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout style="@style/TitleBar">
<ImageView style="@style/TitleBarLogo"
android:contentDescription="@string/description_logo"
android:src="@drawable/logo" />
<ImageView style="@style/TitleBarSeparator" />
<TextView style="@style/TitleBarText" />
<ImageButton style="@style/TitleBarAction"
android:contentDescription="@string/description_about"
android:src="@drawable/about"
android:onClick="onClickAbout" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="match_parent"
android:id="@+id/status"
android:layout_height="wrap_content">
<requestFocus></requestFocus>
</EditText>
<Button android:layout_width="wrap_content" android:text="Ok" android:textColor="@color/title_text" android:layout_gravity="center" android:background="@drawable/custom_button" android:layout_height="wrap_content"></Button>
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical">
<TextView android:textAppearance="?android:attr/textAppearanceMedium" android:layout_width="wrap_content" android:text="" android:id="@+id/updates" android:textSize="14dp" android:layout_height="wrap_content"></TextView>
</LinearLayout>
<TextView android:text="" android:id="@+id/test" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</LinearLayout>
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud) 有没有办法将文本标签添加到android gridview?我正在使用标准的android示例,Hello GridView.
例如,如果我想在每个图像下面添加图像标题,有没有办法做到这一点?如果是这样,有人可以解释这将如何工作?或者,有没有其他方法来实现这一点?谢谢!
android ×5
achartengine ×1
label ×1
line ×1
oauth ×1
scrollview ×1
signpost ×1
spacing ×1
textview ×1